bungpeng Posted December 3, 2003 Posted December 3, 2003 Can I copy my DataReader record to DataSet (or others?), because DataReader is linked to Database, I need to disconnect it, but I still need to process it's content... If there anyway? Quote
Mehyar Posted December 3, 2003 Posted December 3, 2003 Yes you can, simply loop through the datareader and add them to a dataset, but again why dont you simply use the dataset instead ?? Quote Dream as if you'll live forever, live as if you'll die today
bungpeng Posted December 4, 2003 Author Posted December 4, 2003 I have to loop throught the datareader and add them one by one in dataset? No simple way? I just don't want to change much of my code, so looking for simple way. Thank you for your reply Quote
Mehyar Posted December 4, 2003 Posted December 4, 2003 Loop ? I guess so, I dont think there is a simpler way. But why dont you want to loop, It is only 4 to 5 lines of code to add each record to the dataset. And SqlReaders are very fast so you need not worry about the speed of your loop. Readers were made for that... Quote Dream as if you'll live forever, live as if you'll die today
bungpeng Posted December 4, 2003 Author Posted December 4, 2003 As a programmer, we should try a faster way, even thought physically there are not much different... :) Loop for me is wasting resource... Quote
Administrators PlausiblyDamp Posted December 4, 2003 Administrators Posted December 4, 2003 As Mehyar suggested - if you want it in a DataSet why not just create the DataSet and populate it with a DataAdapater? (Which uses the DataReader in a loop to do it's job anyway ;) ) Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
bungpeng Posted December 4, 2003 Author Posted December 4, 2003 Yes, I think this is my only choice... :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.