|
-
Oct 3rd, 2009, 10:19 PM
#1
Thread Starter
Lively Member
[RESOLVED] only getting results from first select in stored procedure using datareader
And I like the speed of the datareader over a datatable, so I'd like to make this work! Using VB.NET 2005. All the prior responses to the same problem say to return to datareader or use a datatable. I have no idea what return to datareader means.
Thanks!
-
Oct 3rd, 2009, 10:40 PM
#2
Re: only getting results from first select in stored procedure using datareader
The DataReader can only "point to" one result set at a time. The Read method will get the next record in the current result set. To move to the next result set you call the NextResult method. Just like Read, NextResult will return True or False, depending on whether there was another result set to move to.
-
Oct 3rd, 2009, 10:50 PM
#3
Re: only getting results from first select in stored procedure using datareader
Keep in mind that you can't back up, as well, so Datareaders are fast, but they are also forward only.
My usual boring signature: Nothing
 
-
Oct 4th, 2009, 12:04 AM
#4
Thread Starter
Lively Member
Re: only getting results from first select in stored procedure using datareader
Its the right application. And I got it
[code/]
Try
connect.Open()
dread = cmdLotNumber.ExecuteReader
While dread.Read()
txtCharge.Text = CStr(dread(0))
tooltype = CStr(dread(1))
txtProcess.Text = CStr(dread(2))
txtWafer.Text = CStr(dread(3))
txtQuantity.Text = CStr(dread(4))
End While
dread.NextResult()
While dread.Read
txt1.Text = CStr(dread(0))
txt2.Text = CStr(dread(1))
txt3.Text = CStr(dread(2))
txt4.Text = CStr(dread(3))
txt5.Text = CStr(dread(4))
'guarantee catch
txt5.Text = CStr(dread(5))
End While
Catch
Try
dread.NextResult()
Dim I As Integer = 0
While dread.Read
Tools(I) = CStr(dread(I))
I += 1
End While
Catch
End Try
connect.Close()
End Try
[/code]
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|