VB error: The formal parameter "@AOID" was not declared as an OUTPUT parameter (CM11874)

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
[background=#efefef]Good day all, [/background]
[background=#efefef] [/background]
[background=#efefef]Please may I ask for your valued assistance... [/background]
[background=#efefef] [/background]
[background=#efefef]I have a script that will insert data into a SQL table using Stored Procedures. [/background]
[background=#efefef] [/background]
[background=#efefef]This script is not complete yet as I am still creating it via trial and error. [/background]
[background=#efefef] [/background]
[background=#efefef]I get the following [/background][background=#efefef]error message[/background][background=#efefef]: [/background]
[background=#efefef] [/background]
[background=#efefef]"The formal parameter "@AO_GRV_ID" was not declared as an OUTPUT parameter, but the actual parameter passed in requested output." [/background]
[background=#efefef] [/background]
[background=#efefef]In the SQL DB, the AO_GRV_ID field is int data type, allows nulls and to my understanding only support inserts. The value is suppose to be null. [/background]
[background=#efefef] [/background]
[background=#efefef]Please have a look at my code below and advise if there is something incorrect that would be causing this issue. [/background]
[background=#efefef][/background] This script is used to perform Supplier Invoice Insertion into the Advantage Database, using Stored Procedures

Option Explicit
dim objConn, conStr, par1, par2, par3, par4, par5, par6, par7, par8, par9, par10, rs, result, command, fields, value, name, SupplierRef, Suppliers_ID, Invoice_No, Invoice_Date, MonthsID, YearsID, UserID, AO_GRV_ID, CompanyID, Transaction_Typeset

objConn = CreateObject("ADODB.command")
SupplierRef = 12345
Suppliers_ID = 123
Invoice_No = 12345
Invoice_Date = "23 May 2013"
MonthsID = 1
YearsID = 7
UserID = 1
AO_GRV_ID = null
CompanyID = 1
Transaction_Type = 8

Const adParamInput = 1 Input parameter
Const adParamOutput = 2 Output parameter
Const adParamUnknown = 0 Direction is unknown
Const adParamInputOutput = 3 Both input and output parameter
Const adParamReturnValue = 4 Return value

Const adVarChar = 200
Const adInteger = 3


conStr = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=TEST;Data Source=xxxx;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=xxxx;Use Encryption for Data=False;Tag with column collation when possible=False"

set par1 = CreateObject("ADODB.Parameter")
set par2 = CreateObject("ADODB.Parameter")
set par3 = CreateObject("ADODB.Parameter")
set par4 = CreateObject("ADODB.Parameter")
set par5 = CreateObject("ADODB.Parameter")
set par6 = CreateObject("ADODB.Parameter")
set par7 = CreateObject("ADODB.Parameter")
set par8 = CreateObject("ADODB.Parameter")
set par9 = CreateObject("ADODB.Parameter")
set par10 = CreateObject("ADODB.Parameter")

par1.Direction=adParamInput
par1.name="@Transaction_Type"
par1.Size=50
par1.Type=adVarChar
par1.Value=Transaction_Type

par2.Direction=adParamInput
par2.name="@SupplierRef"
par2.Size=50
par2.Type=adVarChar
par2.Value=SupplierRef

par3.Direction=adParamInput
par3.name="@Suppliers_ID"
par3.Size=50
par3.Type=adVarChar
par3.Value=Suppliers_ID

par4.Direction=adParamInput
par4.name="@Invoice_No"
par4.Size=50
par4.Type=adVarChar
par4.Value=Invoice_No

par5.Direction=adParamInput
par5.name="@Invoice_Date"
par5.Size=50
par5.Type=adVarChar
par5.Value=Invoice_Date

par6.Direction=adParamOutput
par6.name="@MonthsID"
par6.Size=3
par6.Type=adIntege
rpar6.Value=MonthsID

par7.Direction=adParamInput
par7.name="@YearsID"
par7.Size=50
par7.Type=adVarChar
par7.Value=YearsID

par8.Direction=adParamInput
par8.name="@UserID"
par8.Size=50
par8.Type=adVarChar
par8.Value=UserID

par9.Direction=adParamInput
par9.name="@AO_GRV_ID"
par9.Size=4
par9.Type=adInteger
par9.Value=AO_GRV_ID

par10.Direction=adParamInput
par10.name="@CompanyID"
par10.Size=50
par10.Type=adVarChar
par10.Value=CompanyID

With objConn
.activeconnection = conStr
.commandtype = 4
.commandtext = "sp_AO_Insert_AO_Transactions"
.Parameters.Append par1
.Parameters.Append par2
.Parameters.Append par3
.Parameters.Append par4
.Parameters.Append par5
.Parameters.Append par6
.Parameters.Append par7
.Parameters.Append par8
.Parameters.Append par9
.Parameters.Append par10
.Execute
End with

[background=#efefef]Thank you[/background][background=#efefef] very much, [/background]
[background=#efefef]Regards, [/background]
[background=#efefef]Greg [/background][background=#efefef][/background]

View the full article
 
Back
Top