DataReader or Dataset
-
I have 10 comboboxes and 10 textboxes in my aspx page.Each combobox has to be filled with 50 values.so if we calculate total records it comes around 510.Most of the articles says that datareader is faster than dataset.But since i have more controls and more values, it has to go to database again and again to fetch values. I can use stored procedure and fill the dataset at once, so that i can avoid the roundtrip. Guys can you tell me which one is better in this situation dataset or datareader and if possible the reason. Thanks
-
I have 10 comboboxes and 10 textboxes in my aspx page.Each combobox has to be filled with 50 values.so if we calculate total records it comes around 510.Most of the articles says that datareader is faster than dataset.But since i have more controls and more values, it has to go to database again and again to fetch values. I can use stored procedure and fill the dataset at once, so that i can avoid the roundtrip. Guys can you tell me which one is better in this situation dataset or datareader and if possible the reason. Thanks
-
I have 10 comboboxes and 10 textboxes in my aspx page.Each combobox has to be filled with 50 values.so if we calculate total records it comes around 510.Most of the articles says that datareader is faster than dataset.But since i have more controls and more values, it has to go to database again and again to fetch values. I can use stored procedure and fill the dataset at once, so that i can avoid the roundtrip. Guys can you tell me which one is better in this situation dataset or datareader and if possible the reason. Thanks
hi, I had similar situation and I ended up using the datareader option with multiple result sets from the database. From my own observations the datareader option seemed to be faster. Since I was only reading this data into objects on the web page- then there was no nead for the extra functionality in the Dataset. to parse the data into the comboboxes(DropDownList) and textboxes I used while loops and the .NextResult() method. Wherever the data in some of the the combo boxes was identical (I had 2 combo boxes with this scenario)- then I used a while loop to read the values into a listItem object then I added it to the two combo boxes. here is an example of this below... (N.B. dr is my datareader object)
while (dr.Read()) { ListItem NewItem =new ListItem(); NewItem.Value =dr.GetInt32(0).ToString(); //first column in data NewItem.Text =dr.GetString(1); //second column in data combo1.Items.Add(NewItem); combo2.Items.Add(NewItem); }
hope this helps.:-D simple one