In VBScript (ASP environment), is it possible to pass a parameter with a null value to a stored procedure?
Passing null to a stored procedure, using a command object.
Set cn = CreateObject("ADODB.Connection")
Set cmd = CreateObject("ADODB.Command")
cn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Data Source=.\Test"
Set cmd.ActiveConnection = cn
cmd.CommandText = "TestTable.sp_ModifyData"
cmd.CommandType = 4
cmd.NamedParameters = True
set cnParam = cmd.CreateParameter("@RowID",3,3,,-1)
cmd.Parameters.Append cnParam
set cnParam = cmd.CreateParameter("@AddRemoveModify",3,1,,0)
cmd.Parameters.Append cnParam
set cnParam = cmd.CreateParameter("@Value1",3,1,,0)
cmd.Parameters.Append cnParam
set cnParam = cmd.CreateParameter("@Value2",8,1,-1,"Test")
cmd.Parameters.Append cnParam
set cnParam = cmd.CreateParameter("@value3",5,1,,null)
cmd.Parameters.Append cnParam
set cnParam = cmd.CreateParameter("@value4",5,1,,0)
cmd.Parameters.Append cnParam
set cnParam = cmd.CreateParameter("@value5",8,1,-1,"")
cmd.Parameters.Append cnParam
cmd.Execute
cn.Close
Set cmd = Nothing
Set cn = Nothing
Sorry I didn't put much thought into naming the fields in my database.