Is there way to insert null into mysql from an empty text field in vb.net
thanks..
Assuming you are using ADO.NET, OleDb and parameters, you need to set the value to DBNull.Value
Example:
Using cmd As New OleDb.OleDbCommand()
//... set connection string etc
cmd.Parameters.Add("myFieldName", OleDbType.VarWChar)
cmd.Parameters("myFieldName").Value = DBNull.Value
//... etc
End Using
myCommand.Parameters.AddWithValue("@parameter_name", DBNull.Value) Returns a .read error This one works though so I assume DBNull.Value isnt recognized by vb.net when passing to mysql myCommand.Parameters.AddWithValue("@parameter_name", "")