Ask a Question related to ASP.NET General, Design and Development.
-
Arjen #1
SqlDataReader problem
Hello,
With my SqlDataReader I select 2 records.
Here is a little bit of my code:
SqlDataReader dr = documents.GetDocuments(ModuleId);
// Load first row into Datareader
if (dr.Read()) {
// Read it!
}
// Load second row into Datareader
if (dr.NextResult()) {
// Read it!
}
dr.Close();
The problem is that the second record dr.NextResult() doesn't work. But
there are two records selected!!!
Why is it not working?
Thanks!
Arjen Guest
-
Is there a way to convert a sqldatareader to a dataview?
The sqldatareader is very fast but the dataview is very versatile. I need the features of the dataview and the speed of the datareader. -
Cross-Site Scripting & sqlDataReader
I am using sqlDataReader for Showing data from the Data base. But if the Data from sql is having tags like <script>alert()</script> then it shows an... -
Passing SqlDataReader thro a web service...
Hi, I was trying to generate a c# proxy file which contained a web method that returned SqlDataReader but the wsdl http://localhost/etc etc said... -
DataGrid Custom Paging using SQLDataReader
Hi Everyone, I am trying to implement a DataGrid that uses Custom paging, but the DataSource is a SQLDataReader, not a DataSet. I have seen... -
reading sqldatareader after conn.close()
"Naveen K Kohli" <naveenkohli@hotmail.com> wrote in message news:<uDh3MJKQDHA.2476@TK2MSFTNGP10.phx.gbl>... Thanks. Can I do smt. like in code... -
Marina #2
Re: SqlDataReader problem
If the 2 records are both as a result of one query, then you just need to
call Read again to advance to the next row.
If they are in different record sets, then you need to call Read after
calling NextResult, to advance the next result set to the first row.
"Arjen" <boah123@hotmail.com> wrote in message
news:bg8uq7$eip$1@news4.tilbu1.nb.home.nl...> Hello,
>
> With my SqlDataReader I select 2 records.
>
> Here is a little bit of my code:
> SqlDataReader dr = documents.GetDocuments(ModuleId);
>
> // Load first row into Datareader
> if (dr.Read()) {
> // Read it!
> }
>
> // Load second row into Datareader
> if (dr.NextResult()) {
> // Read it!
> }
>
> dr.Close();
>
> The problem is that the second record dr.NextResult() doesn't work. But
> there are two records selected!!!
>
> Why is it not working?
>
> Thanks!
>
>
Marina Guest
-
MS News #3
Re: SqlDataReader problem
call dr.Read() again and not dr.NextResult()
You don't have multiple Select in your Query??
"Arjen" <boah123@hotmail.com> wrote in message
news:bg8uq7$eip$1@news4.tilbu1.nb.home.nl...> Hello,
>
> With my SqlDataReader I select 2 records.
>
> Here is a little bit of my code:
> SqlDataReader dr = documents.GetDocuments(ModuleId);
>
> // Load first row into Datareader
> if (dr.Read()) {
> // Read it!
> }
>
> // Load second row into Datareader
> if (dr.NextResult()) {
> // Read it!
> }
>
> dr.Close();
>
> The problem is that the second record dr.NextResult() doesn't work. But
> there are two records selected!!!
>
> Why is it not working?
>
> Thanks!
>
>
MS News Guest
-
Arjen #4
Re: SqlDataReader problem
Nope, I understand.
"MS News" <sql_agentman@hotmail.com> schreef in bericht
news:eKlxyNsVDHA.3088@tk2msftngp13.phx.gbl...> call dr.Read() again and not dr.NextResult()
>
> You don't have multiple Select in your Query??
>
>
> "Arjen" <boah123@hotmail.com> wrote in message
> news:bg8uq7$eip$1@news4.tilbu1.nb.home.nl...>> > Hello,
> >
> > With my SqlDataReader I select 2 records.
> >
> > Here is a little bit of my code:
> > SqlDataReader dr = documents.GetDocuments(ModuleId);
> >
> > // Load first row into Datareader
> > if (dr.Read()) {
> > // Read it!
> > }
> >
> > // Load second row into Datareader
> > if (dr.NextResult()) {
> > // Read it!
> > }
> >
> > dr.Close();
> >
> > The problem is that the second record dr.NextResult() doesn't work. But
> > there are two records selected!!!
> >
> > Why is it not working?
> >
> > Thanks!
> >
> >
>
Arjen Guest



Reply With Quote

