Batch SQL Problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Guys,

Basically I'm trying to run a batch sql query but I cannot seem to access
the results from the second sql query. I have simplified the query to help
explain the problem hence why the two queries are the same. Thanks in advance
!


Dim connStr As String = Module1.getString

Dim con As New SqlConnection(connStr)
Dim comm As New SqlCommand
Dim dr As SqlDataReader


con.Open()

comm.CommandText = "Select * from officers; Select * from officers;"

comm.Connection = con


dr = comm.ExecuteReader

dr.Read()
MessageBox.Show(dr(0)) //displays fine
dr.NextResult()
MessageBox.Show(dr(0)) //error thrown saying there is no data in here
 
You need to read something again just like on desktop:

dr.NextResult()
dr.Read() ' Need to read from next result.

--
Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
Back
Top