MichaelaLee
Programmer
Hi everyone.
I wanted to know the best way to set a datetime field to null in VB code. We are using SQL Server. Take the following code
Set mCommand = New ADODB.Command
mCommand.CommandType = adCmdStoredProc
mCommand.CommandText = "nf_UpdateTermination_Import"
mCommand.ActiveConnection = connSQL
mCommand.Parameters.Refresh
mCommand.Parameters("@PatientId").Value = 1
mCommand.Parameters("@DOA").Value = NULL
mCommand.Parameters("@DOT").Value = VBNull
mCommand.Execute
Ok, with the above code I always get a Invalid use of null when I use NULL, if I use vbnull VB/ADO takes over and writes out 12/31/1899. I know that I could whatch for this value to tell if its a null, but in my option, we should not have to do this. What ways are you all doing this. THanks.
Michael
I wanted to know the best way to set a datetime field to null in VB code. We are using SQL Server. Take the following code
Set mCommand = New ADODB.Command
mCommand.CommandType = adCmdStoredProc
mCommand.CommandText = "nf_UpdateTermination_Import"
mCommand.ActiveConnection = connSQL
mCommand.Parameters.Refresh
mCommand.Parameters("@PatientId").Value = 1
mCommand.Parameters("@DOA").Value = NULL
mCommand.Parameters("@DOT").Value = VBNull
mCommand.Execute
Ok, with the above code I always get a Invalid use of null when I use NULL, if I use vbnull VB/ADO takes over and writes out 12/31/1899. I know that I could whatch for this value to tell if its a null, but in my option, we should not have to do this. What ways are you all doing this. THanks.
Michael