By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,925 Members | 1,778 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,925 IT Pros & Developers. It's quick & easy.

cursor returned by stored procedure

P: n/a
Hi

I want to recive some data from db2 (as400) using ado.net in visual
basic. Also i want to access them by stored procedure that return a
cursor. So, i create very simple stored procedure on as400:

P1 : BEGIN BEGIN DECLARE CUR CURSOR WITH RETURN FOR SELECT PRICE,
QUANTITY
EXPORT . SALES ;
OPEN CUR ;
END ;
END P1

and sub in VB:

Dim oledbConnection1 As New
OleDbConnection("********************************* *******")

Dim cmd As New OleDbCommand

Dim reader As OleDbDataReader

cmd.CommandText = "EXPORT.STOR_PROC" ' stor_proc name of
stored procedure i've created above

cmd.CommandType = CommandType.StoredProcedure

cmd.Connection = oledbConnection1

oledbConnection1.Open()

reader = cmd.ExecuteReader()

Do While reader.Read()

Console.WriteLine(reader("PRICE").ToString)

Loop

oledbConnection1.Close()

My problem is: There is no rows returned from this stored procedure,
and I know that in table SALES thera are some records. And i haven't
any error message from as400. What's wrong with that?

thanks in advance, endriu

Feb 5 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Feb 5, 1:04 pm, "endriu" <endr...@go2.plwrote:
Hi

I want to recive some data from db2 (as400) using ado.net in visual
basic. Also i want to access them by stored procedure that return a
cursor. So, i create very simple stored procedure on as400:

P1 : BEGIN BEGIN DECLARE CUR CURSOR WITH RETURN FOR SELECT PRICE,
QUANTITY
EXPORT . SALES ;
OPEN CUR ;
END ;
END P1

and sub in VB:

Dim oledbConnection1 As New
OleDbConnection("********************************* *******")

Dim cmd As New OleDbCommand

Dim reader As OleDbDataReader

cmd.CommandText = "EXPORT.STOR_PROC" ' stor_proc name of
stored procedure i've created above

cmd.CommandType = CommandType.StoredProcedure

cmd.Connection = oledbConnection1

oledbConnection1.Open()

reader = cmd.ExecuteReader()

Do While reader.Read()

Console.WriteLine(reader("PRICE").ToString)

Loop

oledbConnection1.Close()

My problem is: There is no rows returned from this stored procedure,
and I know that in table SALES thera are some records. And i haven't
any error message from as400. What's wrong with that?

thanks in advance, endriu
Hi, Endriu

If you execute the SP by itself (i.e., using CALL in the CLP or the AS/
400 equivalent), do you see a result set? If the answer is "yes," you
may have better luck (cross-)posting in comp.lang .basic.visual.misc
or comp.lang .basic.visual.database.

--Jeff

Feb 5 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.