Click here to Skip to main content
16,007,687 members
Home / Discussions / C#
   

C#

 
GeneralRe: GDI+ questions Pin
Jens Olsson7-Mar-06 5:22
Jens Olsson7-Mar-06 5:22 
GeneralRe: GDI+ questions Pin
[Marc]7-Mar-06 5:40
[Marc]7-Mar-06 5:40 
GeneralRe: GDI+ questions Pin
Jens Olsson7-Mar-06 10:43
Jens Olsson7-Mar-06 10:43 
GeneralRe: GDI+ questions Pin
[Marc]7-Mar-06 10:50
[Marc]7-Mar-06 10:50 
GeneralRe: GDI+ questions Pin
Jens Olsson7-Mar-06 10:46
Jens Olsson7-Mar-06 10:46 
Questionhow to bind the data in datagrid using storedprocedure Pin
eswarattaluri5-Mar-06 21:56
eswarattaluri5-Mar-06 21:56 
AnswerRe: how to bind the data in datagrid using storedprocedure Pin
rccnh6-Mar-06 8:26
rccnh6-Mar-06 8:26 
QuestionHow to show Values in CrystalReportViewer ??? Pin
Abubakarsb5-Mar-06 21:39
Abubakarsb5-Mar-06 21:39 
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 

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.