Anisha Hosting
£10.00 per month
>> Discover more ...
eCommerce Hosting
£14.00 per month
>> Discover more ...
SQL Server Hosting
£22.00 per month
>> Discover more ...
Anisha Tutorials
Your domain available:

Articles

Windows 2003 - IIS6 Hosting Provider

Dot Net Hosting


MySQL

php


free webmail

FREE WebMail as standard
with all hosting account

 


dotnet hosting visual studio.net

Hosting with a difference ...

 

Tutorial - ADO - Multiple DataReaders with one connection object - ADO.NET

To build multiple DataReaders with one connection object its important to close the DataReader before opening the new one.

'# Here gCon is a connection object

'# Build DataReader
tmpDataReader = daUtil.BuildDataReader(gCon, strSQL)
MyDataList1.DataSource = tmpDataReader
MyDataList1.DataBind()
'# Very important to close the DataReader
tmpDataReader.Close()

'# Now build the second DataReader
tmpDataReader = daUtil.BuildDataReader(gCon, strSQL2)
MyDataList2.DataSource = tmpDataReader
MyDataList2.DataBind()
tmpDataReader.Close()



You can also avoid getting the error "There is already an open DataReader associated with this Connection which must be closed first. " by using this technique.

Submitted By:
Gulshan Baryah
New Generation Technoloies Ltd
http://www.ngt.co.uk/

All Rights Reserved Anisha.co.uk