Click here to Skip to main content
15,896,201 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to show Values in CrystalReportViewer ??? Pin
albCode5-Mar-06 21:46
albCode5-Mar-06 21:46 
GeneralRe: How to show Values in CrystalReportViewer ??? Pin
Abubakarsb6-Mar-06 0:18
Abubakarsb6-Mar-06 0:18 
QuestionSQLDataReader Problem Pin
Brendan Vogt5-Mar-06 21:22
Brendan Vogt5-Mar-06 21:22 
AnswerRe: SQLDataReader Problem Pin
Guffa5-Mar-06 21:58
Guffa5-Mar-06 21:58 
QuestionRe: SQLDataReader Problem Pin
Brendan Vogt5-Mar-06 22:17
Brendan Vogt5-Mar-06 22:17 
AnswerRe: SQLDataReader Problem Pin
Guffa5-Mar-06 22:27
Guffa5-Mar-06 22:27 
QuestionRe: SQLDataReader Problem Pin
Brendan Vogt5-Mar-06 22:48
Brendan Vogt5-Mar-06 22:48 
AnswerRe: SQLDataReader Problem Pin
Guffa5-Mar-06 23:48
Guffa5-Mar-06 23:48 
You have to close the data reader after you have read all the data you need from it. In your code you would have to do that after the call to DataBind.

When you are moving data through several layers, you should consider to read the data into a DataSet, or a list of objects.

If you create a title class that has the properties you need in the combo box, you can use an ArrayList of such objects as a data source:

Class Title {

	private int id;
	private string name;

	public Title(int id, string name) {
		this.id = id;
		this.name = name;
	}

	public int TitleID_PK { get { return this.id; } }
	public string TitleName { get { return this.name; } }

}


You create the ArrayList by reading through the data reader:

ArrayList list = new ArrayList();
while (reader.Read()) {
	list.Add(new Title(reader.GetInt32("TitleID_PK"), reader.GetString("TitleName")));
}
reader.Close();



---
b { font-weight: normal; }

Questioncreate new column Pin
angelagke5-Mar-06 21:18
angelagke5-Mar-06 21:18 
AnswerRe: create new column Pin
albCode5-Mar-06 21:22
albCode5-Mar-06 21:22 
GeneralRe: create new column Pin
angelagke5-Mar-06 22:40
angelagke5-Mar-06 22:40 
AnswerRe: create new column Pin
rah_sin6-Mar-06 1:05
professionalrah_sin6-Mar-06 1:05 
AnswerRe: create new column Pin
albCode6-Mar-06 2:54
albCode6-Mar-06 2:54 
GeneralRe: create new column Pin
angelagke6-Mar-06 15:56
angelagke6-Mar-06 15:56 
QuestionVisual style Pin
snjezana5-Mar-06 21:05
snjezana5-Mar-06 21:05 
AnswerRe: Visual style Pin
AB77715-Mar-06 21:44
AB77715-Mar-06 21:44 
QuestionHelp me (directx) ! Pin
hackerhcm5-Mar-06 18:21
hackerhcm5-Mar-06 18:21 
AnswerRe: Help me (directx) ! Pin
hackerhcm5-Mar-06 23:39
hackerhcm5-Mar-06 23:39 
Questionheight and width from a image file Pin
deepak15-Mar-06 17:03
deepak15-Mar-06 17:03 
AnswerRe: height and width from a image file Pin
Super Lloyd5-Mar-06 18:31
Super Lloyd5-Mar-06 18:31 
AnswerRe: height and width from a image file Pin
Super Lloyd5-Mar-06 18:32
Super Lloyd5-Mar-06 18:32 
QuestionCross Thread operation is not Valid Pin
emran8345-Mar-06 10:20
emran8345-Mar-06 10:20 
AnswerRe: Cross Thread operation is not Valid Pin
mikanu5-Mar-06 10:55
mikanu5-Mar-06 10:55 
GeneralRe: Cross Thread operation is not Valid Pin
emran8345-Mar-06 12:03
emran8345-Mar-06 12:03 
GeneralRe: Cross Thread operation is not Valid Pin
mikanu5-Mar-06 12:26
mikanu5-Mar-06 12:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.