Clearing a Date filed in an Access DB ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am using Webmatrix, and I have a Date field in an Access database that I
would like to let the user clear.

However, when the filed is cleared on a web form, and the values are
submitted, there is an error to the effect of:

System.InvalidCastException: Cast from string "" to type 'Date' is not valid

Any ideas?

Thanks, David
 
David,

It is some guesing however probably are you trying to do something (as this
typed in this message so not checked and assuming you are using a SQL update
command) to do this.
\\\
If airframe_date = "" Then
Dim dbParam_airframe_date As System.Data.IDataParameter = New
System.Data.OleDb.OleDbParameter
dbParam_airframe_date.ParameterName = "@airframe_date"
dbParam_airframe_date.DbType = System.Data.DbType.DateTime
dbParam_airframe_date.Value = dbnull.value
dbCommand.Parameters.Add(dbParam_airframe_date)
End if
///

Maybe you can try it, I am looking almost in the dark you know.

Cor
 
Back
Top