Returning Multiple Recordsets, print statements and errors?

G

Guest

if I execute the following proc I can get the first recordset 2 print
statemts and 1 error, but 1 of the print statments and 2 recordsets fail to
show..

Is this possible in ADO.net (Query Analyser has no issues with it....)

Create proc someproc
as
select * from northwind..employees
print 'test'
print 'test2'
raiserror( 'this is a test message',12,4)
select top 1 * from northwind..orders
select top 2 * from northwind..customers
Print 'All DoneQ!'

Specificly I would like to see the second and third recordsets... :)

Any help appreciated.


Rob
 
G

Guest

Oh yeah, I know if I raise the error after all 3 querys run I can see it all,
but I am truely iterested in catching all the data...

code so far looks something like...


Imports System.Data.SqlClient
Public Class DBCom
Dim pConnectionString As String
Dim pCommand As String
Dim WithEvents con As SqlConnection
Dim cmd As SqlCommand
Dim dr As SqlDataReader
Dim ds As New DataSet
Dim dt As DataTable
Dim mController As Controller

Public Sub Initialize(ByVal controller As Controller)
mController = controller
End Sub

Public Sub New(ByVal Command As String, ByVal ConnectionString As String)
pConnectionString = ConnectionString
pCommand = Command
End Sub

Public Sub Run()
con = New SqlConnection(pConnectionString)
con.Open()
cmd = New SqlCommand(pCommand, con)
Dim s As New SqlDataAdapter(cmd)
Try
Dim dt As New DataTable
s.Fill(ds)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Private Sub con_InfoMessage(ByVal sender As Object, ByVal e As
System.Data.SqlClient.SqlInfoMessageEventArgs) Handles con.InfoMessage
MsgBox(e.Message)
End Sub
End Class
 
G

Guest

Cor, sorry... Just used to the old Recordset word (been around tooo long)...
WHat I ment is a DATATABLE which is basicly the same as a client side
recordset with more features :)

However there should be 3 datatables in the dataset, but there is only 1.


Maybe I should repost this as multiple datatables....

Rob
 
C

Cor Ligthert

Rob,

I always write that I hate SQL. (I would use tree dataadapters).

However you have restated your message, so maybe gives that results. (I do
not mean a resultset with that last word)

:)

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top