ADO.NET OleDB command call to RPG program

D

Dean Slindee

I want to execute an RPG report (no parameters needed) from my VB.NET
application. This is ADO.NET using the IBMDA400 provider. The code is all
correct, except possibly the .CommandText line (from the AS/400's point of
view). Anyone got a working .CommandText statement that works? My previous
attempts are commented out (none worked).

Dim cn As New OleDbConnection(cnStringOLE)

Dim cmd As New OleDbCommand("", cn)

Dim da As New OleDbDataAdapter(cmd)

Try

cn.Open()

With cmd

.CommandType = CommandType.Text

'.CommandText = "{{CALL /QSYS.LIB/" & strLibrary & ".LIB/" &
strProgram & ".PGM(?,?,?)}}"

'.CommandText = "{{CALL /QSYS.LIB/" & strLibrary & ".LIB/" &
strProgram & ".PGM}}"

'.CommandText = "{{CALL /QSYS.LIB/HHSLIBF.LIB/SCR130.PGM}}"

.CommandText = "{{CALL /HHSLIBF.LIB/SCR130.PGM}}"

.ExecuteNonQuery()

End With

Catch exc As Exception

Call ExceptionHandler(csqlAdmin, exc)

Debug.WriteLine(Err.Number, Err.Description)

Finally

cn.Close()

da = Nothing

cmd = Nothing

cn = Nothing

End Try

Thanks,

Dean Slindee
 
K

Kevin Yu [MSFT]

Hi Dean,

Thank you for posting in the community!

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that your OleDbCommand doesn't work in a VB
application. If there is any misunderstanding, please feel free to let me
know.

I have checked your code and it seems that nothing is wrong with the VB.NET
code. So I think we have to check the command text to see if it works on
the server. I'm not quite familiar this DBMS. So could you please try to
use some tools provided by the database server to run the command text?
(Such as Query Analyzer in SQL Server.) So we can isolate the problem to
see if there is something to do with the command text or the provider.
Thank you for you cooperation.

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
B

bill.dodd

I have a commandtext that works:
ActionCmd.CommandText = "{{sndmsg msg('hi from vb') tousr(billd)}}"



**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 
B

bill.dodd

I have a commandtext that works:
ActionCmd.CommandText = "{{sndmsg msg('hi from vb') tousr(billd)}}"

I run it and get the interactive message on my system.. I am - however - having problems with a commantext where I'm building parameters that (I hope) the CL will change and pass back out into the VB.Net

For that one, I've been trying:
ActionCmd.CommandText = "{{CALL pgm(MYLIB/MYCL) parm(?,?,?,?,?,?,?,?,?)}}"
and building the subsequent oledbparameter collection below it.. That hasn't worked for me, yet. the sndmsg definitely worked.

Bill Dodd
mcsd,mcad,mcdba
(e-mail address removed)


**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 
B

Brad Hudson

I am encountering the same problem. I can do a sndmsg and the message
is sent to my AS/400 account, but I can not call an RPG program with
parameters from a command text. Did anybody every figure this problem
out? I appreciate your help.

Brad Hudson
(e-mail address removed)
 

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