well I thought you were directly inserting into the database Since you seem to have a Sql/Oledb command in place and executing it - you are directly inserting into the database.
Still as suggested, you need to make your parameter values appropriate for successful insertion of data in your database, currently you are recieving those errors.
As suggested, try to do this:
if Me.theTextBox.Text.Length = 0 then
theParameter.Value = DBNull.Value
else
theParameter.Value = CDate(Me.theTextbox.Text)
end if
of course, replace the parameter names and so on appropriately. If this does not work, you can just ignore the first part of the if statement and try again however logically speaking, and I believe I have done this before but cant quite remember, it should work with DBNull.Value as when inserting, if the column allows nulls then this would be the equivilent (well it is technically) of a database null value field.
|