March 3, 2005 at 4:35 am
March 3, 2005 at 5:46 am
I have not used ASP.NET so if this seems a silly question please forgive me. Have you tried CREATEPARAMETER 1st telling the system which direction the parameter is and of what type and THEN assigning the PARAMETER the values you want?
EXAMPLE that I have used in VB
'' Starts the definition of the Command object to execute SQL stored-procedure
With adoCmd
.ActiveConnection = cADOConn.Connection
.CommandText = "dbo.usp_xxxxxxxxxxxxxxx"
.CommandType = adCmdStoredProc
Set adoParams = .Parameters
End With
'' Defines the ADO parameters for use by the stored-procedure
With adoParams
.Append adoCmd.CreateParameter("@RETURN_VALUE", adInteger, adParamReturnValue, 0)
.Append adoCmd.CreateParameter("@RecordDate", adChar, adParamInput, 10)
.Append adoCmd.CreateParameter("@TimeSystemID", adInteger, adParamInput, 1)
.Append adoCmd.CreateParameter("@RecordType", adChar, adParamInput, 1)
.Append adoCmd.CreateParameter("@Location", adInteger, adParamInput, 4)
.Append adoCmd.CreateParameter("@MachineName", adVarChar, adParamInput, 255)
.Append adoCmd.CreateParameter("@UserID", adVarChar, adParamInput, 255)
End With
'' Populates the parameters with data
adoParams("@RecordDate") = Calendar1.Value
adoParams("@TimeSystemID") = frmMain.cboTimeSystemID.ListIndex
adoParams("@RecordType") = vRecordType
adoParams("@Location") = frmMain.txtLocation
adoParams("@MachineName") = vMachineName
adoParams("@UserID") = vDomain & "\" & vUserLoggedIn
'' EXECUTE Updating the system
adoCmd.Execute
adoParams("@RETURN_VALUE") = adoCmd.Parameters("@RETURN_VALUE")
Also when you are done do you clean up the parameters collection? I.E. something like..
Dim i As Integer
'' USES Step -1 to delete last parameter and down. This is the only way to _
delete parameters (Highest number to lowest). This collection is a 0 based array.
With adoParams
For i = .Count To 1 Step -1
.Delete (i - 1)
Next
End With
Good Hunting!
AJ Ahrens
webmaster@kritter.net
March 3, 2005 at 6:45 am
I've managed to sort the problem now.
VS.Net was trying ot add parameters by default automatically so i had 2 sets of parameters being input to the db
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply