Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute multiple queries with SqlDataReader 1

Status
Not open for further replies.

iaswnidou

Programmer
Apr 19, 2005
140
GR
Hello

I have a method that returns a datareader as this:
Code:
Protected Function SelectReader(ByVal SQL As String) As SqlDataReader
        objCmd.CommandText = SQL
        Dim rdr As SqlDataReader

        Try
            OpenConnection()
            rdr = objCmd.ExecuteReader(CommandBehavior.CloseConnection)
        Catch exSQL As SqlException
            errorMsg = exSQL.Message
            NotifyAdmin("SelectReader", SQL, errorMsg)
        Catch ex As Exception
            errorMsg = ex.Message
            Throw ex
        Finally
            objCmd.Dispose()
        End Try

        Return rdr
    End Function

Can i feed it with a SQL string as this?
Code:
"Select a from b;select c from d;"

When i execute this, only "a" is returned. Is it possible to execute multiple queries? (in asp.net 1.1)
 
Google this: SqlDataReader.NextResult()


Vince
 
iaswnidou, Can you provide a sample of how you used SqlDataReader.NextResult. I would be interested in seeing that.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top