473,765 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help again

This thing is about to drive me crazy. I have about 50 queries in the AS400
that I need to put on a menu. Once I conquer this I have a bunch more rpg
reports that I need to pass a date to. In the AS400 I have a stored
procedure (SPRUNQRY) that runs the RUNQRY command with the name of the query
as a parameter. In the AS400 I would type "RUNQRY SUNTR401A" on a command
line to run this query. My connection is opening, and I can run some reports
that do not have any parameters. My VB.net 2003 is:

'create command object

Dim cmd As New iDB2Command(" ", cn)

'setup the parameters

Dim cmdparm1 As New iDB2Parameter(" cmdparm1", iDB2DbType.iDB2 VarChar, 9)

cmdparm1.Value = "SUNTR401A"

cmdparm1.Direct ion = ParameterDirect ion.Output

cmd.Parameters. Add(cmdparm1)

cmd.CommandType = CommandType.Sto redProcedure

cmd.CommandText = "{CALL hteusrj/sprunqry ( ? )}"

Try

cmd.ExecuteNonQ uery()

Catch exc As iDB2Exception

MsgBox("execute did not work", MsgBoxStyle.OKO nly, "OK")

Exit Sub

End Try

This catches an error when it tries to execute the command The error says:
{IBM.Data.DB2.i Series.iDB2SQLE rrorException}

and also: message code -104 and message: "SQL0104 Token {was not valid.
Valid tokens : : <IDENTIFIER>. "

I can't figure out exactly what it wants. I could sure use some help, I've
spun my wheels for several days on this.

Thanks in advance,

Joe in Florida


Jan 29 '07 #1
3 4096

The parameter direction should be input. (That's the default, so I would
just eliminate that line). That indicates whether you are sending into *in*
to the SP or if you're getting something back. Output Parameters are
usually used for getting back autoincrement values assigned to inserted
records.

You command text needs to *not* have curly braces in it; it looks like
that's what the AS400 is kicking back. The CommandText needs to be the
*name* of the stored procedure that you are running, so if
"hteusrj/sprunqry" is really the name of the stored procedure in the
database, I think this will work:

cmd.CommandText = "hteusrj/sprunqry"

Does that work?

Robin S.
---------------------------------------------
"Darth Ferret" <no***********@ nowhere.comwrot e in message
news:OB******** ******@TK2MSFTN GP02.phx.gbl...
This thing is about to drive me crazy. I have about 50 queries in the
AS400 that I need to put on a menu. Once I conquer this I have a bunch
more rpg reports that I need to pass a date to. In the AS400 I have a
stored procedure (SPRUNQRY) that runs the RUNQRY command with the name of
the query as a parameter. In the AS400 I would type "RUNQRY SUNTR401A" on
a command line to run this query. My connection is opening, and I can run
some reports that do not have any parameters. My VB.net 2003 is:

'create command object

Dim cmd As New iDB2Command(" ", cn)

'setup the parameters

Dim cmdparm1 As New iDB2Parameter(" cmdparm1", iDB2DbType.iDB2 VarChar, 9)

cmdparm1.Value = "SUNTR401A"

cmdparm1.Direct ion = ParameterDirect ion.Output

cmd.Parameters. Add(cmdparm1)

cmd.CommandType = CommandType.Sto redProcedure

cmd.CommandText = "{CALL hteusrj/sprunqry ( ? )}"

Try

cmd.ExecuteNonQ uery()

Catch exc As iDB2Exception

MsgBox("execute did not work", MsgBoxStyle.OKO nly, "OK")

Exit Sub

End Try

This catches an error when it tries to execute the command The error
says: {IBM.Data.DB2.i Series.iDB2SQLE rrorException}

and also: message code -104 and message: "SQL0104 Token {was not valid.
Valid tokens : : <IDENTIFIER>. "

I can't figure out exactly what it wants. I could sure use some help,
I've spun my wheels for several days on this.

Thanks in advance,

Joe in Florida


Jan 29 '07 #2
Thank you for your help Robin,

I made the changes and received the message below the code about a qualified
object. On a lark I tried using hteusrj.spcrunq ry with a period instead of a
slash and it just hangs:
'create command object

Dim cmd As New iDB2Command(" ", cn)

'setup the parameters

Dim cmdparm1 As New iDB2Parameter(" cmdparm1", iDB2DbType.iDB2 VarChar, 9)

cmdparm1.Value = "SUNTR401A"

cmd.Parameters. Add(cmdparm1)

cmd.CommandType = CommandType.Sto redProcedure

cmd.CommandText = "hteusrj/sprunqry"

Try

cmd.ExecuteNonQ uery()

Catch exc As iDB2Exception

MsgBox("execute did not work", MsgBoxStyle.OKO nly, "OK")

Exit Sub

End Try

=============== ==========

Message "SQL5016 Qualified object name SPRUNQRY not valid." String

It's getting closer. MessageDetails "Cause . . . . . : One of the
following has occurred: -- The syntax used for the qualified object name is
not valid for the naming option specified. With system naming, the
qualified form of an object name is schema-name/object-name. With SQL
naming the qualified form of an object name is
authorization-name.object-name. -- The syntax used for the qualified object
name is not allowed. User-defined types cannot be qualified with the schema
in the system naming convention on parameters and SQL variables of an SQL
procedure or function. Recovery . . . : Do one of the following and try
the request again: -- If you want to use the SQL naming convention, verify
the SQL naming option in the appropriate SQL command and qualify the object
names in the form authorization-id.object-name. -- If you want to use the
system naming convention, specify the system naming option in the
appropriate SQL command and qualify the object names in the form
schema-name/object-name. -- With the system naming convention, ensure the
user-defined types specified for parameters and variables in an SQL routine
can be found in the current path." String

"RobinS" <Ro****@NoSpam. yah.nonewrote in message
news:5r******** *************** *******@comcast .com...
>
The parameter direction should be input. (That's the default, so I would
just eliminate that line). That indicates whether you are sending into
*in* to the SP or if you're getting something back. Output Parameters are
usually used for getting back autoincrement values assigned to inserted
records.

You command text needs to *not* have curly braces in it; it looks like
that's what the AS400 is kicking back. The CommandText needs to be the
*name* of the stored procedure that you are running, so if
"hteusrj/sprunqry" is really the name of the stored procedure in the
database, I think this will work:

cmd.CommandText = "hteusrj/sprunqry"

Does that work?

Robin S.
---------------------------------------------
"Darth Ferret" <no***********@ nowhere.comwrot e in message
news:OB******** ******@TK2MSFTN GP02.phx.gbl...
>This thing is about to drive me crazy. I have about 50 queries in the
AS400 that I need to put on a menu. Once I conquer this I have a bunch
more rpg reports that I need to pass a date to. In the AS400 I have a
stored procedure (SPRUNQRY) that runs the RUNQRY command with the name of
the query as a parameter. In the AS400 I would type "RUNQRY SUNTR401A" on
a command line to run this query. My connection is opening, and I can run
some reports that do not have any parameters. My VB.net 2003 is:

'create command object

Dim cmd As New iDB2Command(" ", cn)

'setup the parameters

Dim cmdparm1 As New iDB2Parameter(" cmdparm1", iDB2DbType.iDB2 VarChar, 9)

cmdparm1.Val ue = "SUNTR401A"

cmdparm1.Direc tion = ParameterDirect ion.Output

cmd.Parameters .Add(cmdparm1)

cmd.CommandTyp e = CommandType.Sto redProcedure

cmd.CommandTex t = "{CALL hteusrj/sprunqry ( ? )}"

Try

cmd.ExecuteNon Query()

Catch exc As iDB2Exception

MsgBox("execut e did not work", MsgBoxStyle.OKO nly, "OK")

Exit Sub

End Try

This catches an error when it tries to execute the command The error
says: {IBM.Data.DB2.i Series.iDB2SQLE rrorException}

and also: message code -104 and message: "SQL0104 Token {was not valid.
Valid tokens : : <IDENTIFIER>. "

I can't figure out exactly what it wants. I could sure use some help,
I've spun my wheels for several days on this.

Thanks in advance,

Joe in Florida



Jan 29 '07 #3
What is the name of the parameter in the stored procedure? For example,
this is a stored procedure from SQLServer, and the parameter name is
@CustomerID. So when I add a parameter to my parameterlist containing the
value for this, I have to call the parameter @CustomerID. Is yours really
called "cmdparm1" on the database side?

SELECT CustomerID,
LastName,
FirstName,
Address,
City,
State,
Zip,
Phone
FROM Customer
WHERE (CustomerID = @CustomerID)

And is the stored procedure *really* called "hteusrv/spcrunqry" ? I ask
because I've never seen a stored procedure name with a slash in it.

Robin S.
--------------------------------------------

"Darth Ferret" <no***********@ nowhere.comwrot e in message
news:OT******** ******@TK2MSFTN GP02.phx.gbl...
Thank you for your help Robin,

I made the changes and received the message below the code about a
qualified object. On a lark I tried using hteusrj.spcrunq ry with a period
instead of a slash and it just hangs:
'create command object

Dim cmd As New iDB2Command(" ", cn)

'setup the parameters

Dim cmdparm1 As New iDB2Parameter(" cmdparm1", iDB2DbType.iDB2 VarChar, 9)

cmdparm1.Value = "SUNTR401A"

cmd.Parameters. Add(cmdparm1)

cmd.CommandType = CommandType.Sto redProcedure

cmd.CommandText = "hteusrj/sprunqry"

Try

cmd.ExecuteNonQ uery()

Catch exc As iDB2Exception

MsgBox("execute did not work", MsgBoxStyle.OKO nly, "OK")

Exit Sub

End Try

=============== ==========

Message "SQL5016 Qualified object name SPRUNQRY not valid." String

It's getting closer. MessageDetails "Cause . . . . . : One of the
following has occurred: -- The syntax used for the qualified object name
is not valid for the naming option specified. With system naming, the
qualified form of an object name is schema-name/object-name. With SQL
naming the qualified form of an object name is
authorization-name.object-name. -- The syntax used for the qualified
object name is not allowed. User-defined types cannot be qualified with
the schema in the system naming convention on parameters and SQL
variables of an SQL procedure or function. Recovery . . . : Do one of
the following and try the request again: -- If you want to use the SQL
naming convention, verify the SQL naming option in the appropriate SQL
command and qualify the object names in the form
authorization-id.object-name. -- If you want to use the system naming
convention, specify the system naming option in the appropriate SQL
command and qualify the object names in the form
schema-name/object-name. -- With the system naming convention, ensure the
user-defined types specified for parameters and variables in an SQL
routine can be found in the current path." String

"RobinS" <Ro****@NoSpam. yah.nonewrote in message
news:5r******** *************** *******@comcast .com...
>>
The parameter direction should be input. (That's the default, so I would
just eliminate that line). That indicates whether you are sending into
*in* to the SP or if you're getting something back. Output Parameters
are usually used for getting back autoincrement values assigned to
inserted records.

You command text needs to *not* have curly braces in it; it looks like
that's what the AS400 is kicking back. The CommandText needs to be the
*name* of the stored procedure that you are running, so if
"hteusrj/sprunqry" is really the name of the stored procedure in the
database, I think this will work:

cmd.CommandText = "hteusrj/sprunqry"

Does that work?

Robin S.
---------------------------------------------
"Darth Ferret" <no***********@ nowhere.comwrot e in message
news:OB******* *******@TK2MSFT NGP02.phx.gbl.. .
>>This thing is about to drive me crazy. I have about 50 queries in the
AS400 that I need to put on a menu. Once I conquer this I have a bunch
more rpg reports that I need to pass a date to. In the AS400 I have a
stored procedure (SPRUNQRY) that runs the RUNQRY command with the name
of the query as a parameter. In the AS400 I would type "RUNQRY
SUNTR401A" on a command line to run this query. My connection is
opening, and I can run some reports that do not have any parameters. My
VB.net 2003 is:

'create command object

Dim cmd As New iDB2Command(" ", cn)

'setup the parameters

Dim cmdparm1 As New iDB2Parameter(" cmdparm1", iDB2DbType.iDB2 VarChar,
9)

cmdparm1.Valu e = "SUNTR401A"

cmdparm1.Dire ction = ParameterDirect ion.Output

cmd.Parameter s.Add(cmdparm1)

cmd.CommandTy pe = CommandType.Sto redProcedure

cmd.CommandTe xt = "{CALL hteusrj/sprunqry ( ? )}"

Try

cmd.ExecuteNo nQuery()

Catch exc As iDB2Exception

MsgBox("execu te did not work", MsgBoxStyle.OKO nly, "OK")

Exit Sub

End Try

This catches an error when it tries to execute the command The error
says: {IBM.Data.DB2.i Series.iDB2SQLE rrorException}

and also: message code -104 and message: "SQL0104 Token {was not valid.
Valid tokens : : <IDENTIFIER>. "

I can't figure out exactly what it wants. I could sure use some help,
I've spun my wheels for several days on this.

Thanks in advance,

Joe in Florida




Jan 30 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2148
by: xuatla | last post by:
Hi, I encountered the following compile error of c++ and hope to get your help. test2.cpp: In member function `CTest CTest::operator+=(CTest&)': test2.cpp:79: error: no match for 'operator=' in '*this = CTest::operator+(CTest&)((+t2))' test2.cpp:49: error: candidates are: CTest CTest::operator=(CTest&) make: *** Error 1
9
4354
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my predecessor, I hasten to add) so that each day it creates a copy of the record for each company, changes the date to today's date, and prompts the user for any changes of ratings on that day. The resulting data table grows by approx 600 records per...
6
391
by: Mark Reed | last post by:
Hi all, I am trying to learn a little about programming (I know next to nothing so far) and have found some code which hides the toolbars. However, this bit of code is a little too effective and hides all of them including hiding the database window, disabling menu changes. What I am after is the same effect as disabling all the check boxes in startup which still leaves 'File', 'Edit', 'Insert','Records','Window' &'Help'. I want to do this...
27
2114
by: SK | last post by:
Hi I am trying to teach myself how to program in C. I am a physician hoping to be able to help restructure my office. Anyhow, I amhoping that the porblem I am having is simple to those much more experienced in programming. I am trying to use the concept of arrays to calculate the hours of my backoffice staff, however I am getting a ridiculous amount of error lines. If any one has time to help me that would be great. I am using the...
23
3282
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application to create certain textboxes, labels, and combo boxes? Any ideas would be appreciated. Thanks
13
3709
by: Chua Wen Ching | last post by:
Hi there, I saw this article here in vb.net. http://www.error-bank.com/microsoft.public.dotnet.languages.vb.1/148992_Thread.aspx and http://www.opennetcf.org/forums/post.asp?method=ReplyQuote&REPLY_ID=3922&TOPIC_ID=2224&FORUM_ID=35
15
2099
by: DavidS | last post by:
Have Visual Studio.NET installed on MS 2000 Professional OS laptop. No issue ever with web development and SQL connections. Purchased new laptop with XP Professional SP2!!!!!!!! & Visual Studio.NET installed. Nothing but headaches. Continually getting System.Data.SqlClient.SqlException : Timeout expired message - The timeout period elapsed prior to completion of the operation or the server is not responding. Can anyone help with...
2
5047
by: John Regan | last post by:
Hello All I am trying to find the owner of a file or folder on our network (Windows 2000 Server) using VB.Net and/or API. so I can search for Folders that don't follow our company's specified folder structure and naming conventions and then send a Net send message to those users telling them to rectify. The information I want to get is when you select the file/folder and then: Properties -> Security Tab -> Advanced Button -> Owner Tab ->...
15
2580
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to determine who needs to receive the text message then send the message to the address. Only problem is, the employee may receive up to 4 of the same messages because each thread gets the recors then sends the message. I need somehow to prevent...
0
9398
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9951
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5421
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2805
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.