473,396 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

VB .NET parameters seems to only use order

Trying VB .NET.

CREATE PROCEDURE A(A INTEGER, OUT B CHAR(1)) BEGIN SET B = 'C'; END

In VB, opened a standard form, associated the .NET dll, in the code
added Imports IBM.Data.DB2, and added the following code to form1.load.

Dim DB As DB2Connection
Dim Command As DB2Command
Dim Parameter1 As DB2Parameter
Dim Parameter2 As DB2Parameter
DB = New DB2Connection("[dbstring]")
DB.Open()

Command = DB.CreateCommand
Command.CommandType = CommandType.StoredProcedure
Command.CommandText = "[schema].A"

Parameter1 = New DB2Parameter("A", DB2Type.Integer, 0,
ParameterDirection.Input, True, 0, 0, "A", DataRowVersion.Current, 0)
Parameter2 = New DB2Parameter("B", DB2Type.Char, 1,
ParameterDirection.Output, True, 0, 0, "B", DataRowVersion.Current, "")

Command.Parameters.Add(Parameter1)
Command.Parameters.Add(Parameter2)

Command.ExecuteNonQuery()

MsgBox(Command.Parameters.Item("B").Value)

DB.Close()

That works perfectly. Yet, if i change the order of the parameters That
is, i change:

Command.Parameters.Add(Parameter1)
Command.Parameters.Add(Parameter2)

to:

Command.Parameters.Add(Parameter2)
Command.Parameters.Add(Parameter1)
I recieve an error:

An unhandled exception of type 'System.ArgumentException' occurred in
microsoft.visualbasic.dll

Additional information: Argument 'Prompt' cannot be converted to type
'String'.

Through other testing, i think i saw that passing the name of the
parameter is completely ignored, as only the order they are added is
used.

Am i doing something wrong? Is name instead of order supported?

B.

May 19 '06 #1
0 1124

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

Similar topics

5
by: Bruno Alexandre | last post by:
Hi guys, withou using SP, I want to be able to add a Parameter to the SQL Query and retrive the Recordset so I can use the Paging property under the recorset object.... how can I do this? I'm...
14
by: | last post by:
Hi, I was performing SQL UPDATE queries and I notice that they SUCCEED on the ExecuteNonQuery() call with NO exceptions raised BUT they fail at the Database. They say they succeed in the code...
7
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
4
by: Mike Dinnis | last post by:
Hi, I've been working through a number of turorials to try to learn more about retrieving data from a SQL database. I think i've mastered techniques where i create a sql string in the page and...
10
by: Adis | last post by:
Asp.Net Visual Studio 2003 SQL Server. Hi, Obtaining Data Based Upon Multiple Selections From a ListBox... I have database in Sqlserver and ListBox (Multiple Selection Mode) in my Visual...
7
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
0
by: Xah Lee | last post by:
In this article, i explain how the use of bit masks is a hack in many imperative languages. Often, a function will need to take many True/False parameters. For example, suppose i have a function...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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,...

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.