How do I insert NULL values in a SQL Server DB table in a column whose
datatype is int? This is what I am trying currently (in the
UpdateCommand event function of a DataGrid):
----------------------------
Dim strSQL As String
Dim objErrorPercent age As Object
If (CType(ea.Item. Cells(8).Contro ls(0), TextBox).Text = "") Then
objErrorPercent age = DBNull.Value
Else
objErrorPercent age = CType(ea.Item.C ells(8).Control s(0),
TextBox).Text
End If
strSQL = "UPDATE Table1 SET.......Error Perc = " & objErrorPercent age &
".....WHERE.... ."
----------------------------
But the above generates the "Incoorrect syntax" error if the TextBox
is empty.
datatype is int? This is what I am trying currently (in the
UpdateCommand event function of a DataGrid):
----------------------------
Dim strSQL As String
Dim objErrorPercent age As Object
If (CType(ea.Item. Cells(8).Contro ls(0), TextBox).Text = "") Then
objErrorPercent age = DBNull.Value
Else
objErrorPercent age = CType(ea.Item.C ells(8).Control s(0),
TextBox).Text
End If
strSQL = "UPDATE Table1 SET.......Error Perc = " & objErrorPercent age &
".....WHERE.... ."
----------------------------
But the above generates the "Incoorrect syntax" error if the TextBox
is empty.
Comment