i need help about COMMAND and PARAMETERS Object in ADODB in Visual Basic 6.0>>>>
i have some code that uses command and parameters object. ADODB connection is connected to a access.mdb file.
all parameters are constructed in a stored procedure in sas.mdb before.
I've declared more than one parameters in my code.I've declared my fisrt parameter and append it to command object collection. for next parameter, i have constructed new parameters with the same parameter's name in next line in code, such this:
"set objprm=new adodb.parameters" (objprm is my parameters' object name)
for all parameters i've done likely and finally will execute command object.
when i track my code step by step with f8, it performs exactly and gives solution ,,but when i run it with f5, it gives wrong solution that differs from first. also if i run it with f5 several times,
it gives different solutions every time.....
i don't know what i must to do ..i'm sure that there is a problem in PARAMETERS DECLERATION but i don't know exactly where.
here's a piece of my code..
mobjCnn.Open JETOLEDB & App.Path & "\SAS.mdb;"
Set mobjPrm = New ADODB.Parameter
Set mobjCmd = New ADODB.Command
With mobjCmd
.ActiveConnection = mobjCnn
.CommandType = adCmdStoredProc
.CommandText = "cmdone"
End With
With mobjPrm
.Name = "prmone"
.Type = adInteger
.Direction = adParamInput
.Value = 2
End With
mobjCmd.Parameters.Append mobjPrm
Set mobjPrm = New ADODB.Parameter
With mobjPrm
.Name = "prmtwo"
.Type = adInteger
.Direction = adParamInput
.Value = 2
End With
mobjCmd.Parameters.Append mobjPrm
Set mobjPrm = New ADODB.Parameter
With mobjPrm
.Name = "prmthree"
.Type = adBoolean
.Direction = adParamInput
.Value = False
End With
mobjCmd.Parameters.Append mobjPrm
Set mobjRst = mobjCmd.Execute