Home > Software engineering >  Vb connection used to implement with parameters of the stored procedure
Vb connection used to implement with parameters of the stored procedure

Time:10-06

Ask everybody to help, make for a long time all can not get it

CodePudding user response:

This question is quite simple
Build:
The CREATE PROC GG (@ id VARCHAR (80))
DECLARE @ CODE VARCHAR (80)
The SET @ CODE=@ id
Print @ CODE
Execution:
The exec GG 'aaa'

CodePudding user response:

Post code, see how you access,

CodePudding user response:

Stick the parameters of the stored procedure definition and the calling code, is usually a parameter setting error,

CodePudding user response:

 
Public cn As New ADODB. Connection 'definition connect
Public strCn As String 'define the connection character
STRCN="... "
Cn. Open strCn
Take parameters of the stored procedure call down

Dim para1 As New ADODB library. The Parameter input parameters'

Dim adoCmd As New ADODB.Com mand 'definition stored domestic

With adoCmd 'setting stored procedure
The ActiveConnection=cn
The CommandType=adCmdStoredProc
The CommandText="name" stored procedure name
End With
With para1 'setting the input parameters 1
.name="@ id entrepot storage" parameter Name, and the parameters of the stored procedure corresponding
. Type=ADODB. DataTypeEnum. AdInteger parameter Type
. Direction=ADODB. ParameterDirectionEnum. AdParamInput 'parameters input and output mode
End With

AdoCmd. The Parameters. Append para1 add variables to the stored procedure

Para1. Value=https://bbs.csdn.net/topics/id_ entrepot storage set the Value of the stored procedure
'AdoCmd. Execute 'Execute the stored procedure
After

Stickers to put,, ha ha

CodePudding user response:

The
refer to the original poster u014400534 response:
ask everybody to help, don't make for a long time all out
the original poster to put
  • Related