I am trying to pass a set of paremters to a sql stored procedure, various ints, varchars and dates. Now m yprog save say 20 fields, but only 10 are required so the function must be able to run with the bare bones data,
now this should not be a problem, except, I use three dates in the stored proc, two of them are required, one is not, and I get method parameter failed for object dbcommand when i try adn pass a "" txtDateclosed, cod eis vbelow, any help on this woudl be greatly appreciated.
Set dbcommand = New ADODB.Command
dbcommand.ActiveConnection = dbconn
dbcommand.CommandType = adCmdStoredProc
dbcommand.CommandText = "spAddUpdateWarrantyOEM"
'add the paremters
With dbcommand
.Parameters.Append .CreateParameter("P1", adVarChar, adParamInput, 50, txtWarFileNo.Text)
.Parameters.Append .CreateParameter("P2", adVarChar, adParamInput, 50, txtWONo.Text)
.Parameters.Append .CreateParameter("P3", adVarChar, adParamInput, 50, txtPreviousWO.Text)
.Parameters.Append .CreateParameter("P4", adVarChar, adParamInput, 50, txtPartNumber.Text)
.Parameters.Append .CreateParameter("P5", adInteger, adParamInput)
.Parameters("P5").Value = cboWarrantyCause.ItemData(cboWarrantyCause.ListIndex)
.Parameters.Append .CreateParameter("P6", adInteger, adParamInput)
.Parameters("P6").Value = cboWarrantyType.ItemData(cboWarrantyType.ListIndex)
.Parameters.Append .CreateParameter("P7", adInteger, adParamInput)
.Parameters("P7").Value = cboOEMDepartment.ItemData(cboOEMDepartment.ListIndex)
.Parameters.Append .CreateParameter("P8", adDBDate, adParamInput, 8, txtDateOpened.Text)
this is the line where i get the error, so I know the date field that has a value is working, but it won't let me pass a blank date
("P9", adDBDate, adParamInput, 8, txtDateClosed.Text)
as the above field is not required it msut be allowed to be blank
Just a note - i searched all ove rthis siote to find a solution b4 postin gthis.
Thanks all!
now this should not be a problem, except, I use three dates in the stored proc, two of them are required, one is not, and I get method parameter failed for object dbcommand when i try adn pass a "" txtDateclosed, cod eis vbelow, any help on this woudl be greatly appreciated.
Set dbcommand = New ADODB.Command
dbcommand.ActiveConnection = dbconn
dbcommand.CommandType = adCmdStoredProc
dbcommand.CommandText = "spAddUpdateWarrantyOEM"
'add the paremters
With dbcommand
.Parameters.Append .CreateParameter("P1", adVarChar, adParamInput, 50, txtWarFileNo.Text)
.Parameters.Append .CreateParameter("P2", adVarChar, adParamInput, 50, txtWONo.Text)
.Parameters.Append .CreateParameter("P3", adVarChar, adParamInput, 50, txtPreviousWO.Text)
.Parameters.Append .CreateParameter("P4", adVarChar, adParamInput, 50, txtPartNumber.Text)
.Parameters.Append .CreateParameter("P5", adInteger, adParamInput)
.Parameters("P5").Value = cboWarrantyCause.ItemData(cboWarrantyCause.ListIndex)
.Parameters.Append .CreateParameter("P6", adInteger, adParamInput)
.Parameters("P6").Value = cboWarrantyType.ItemData(cboWarrantyType.ListIndex)
.Parameters.Append .CreateParameter("P7", adInteger, adParamInput)
.Parameters("P7").Value = cboOEMDepartment.ItemData(cboOEMDepartment.ListIndex)
.Parameters.Append .CreateParameter("P8", adDBDate, adParamInput, 8, txtDateOpened.Text)
this is the line where i get the error, so I know the date field that has a value is working, but it won't let me pass a blank date
("P9", adDBDate, adParamInput, 8, txtDateClosed.Text)
as the above field is not required it msut be allowed to be blank
Just a note - i searched all ove rthis siote to find a solution b4 postin gthis.
Thanks all!