-
sql insert problem
Dear All
I collecting data from an aspx form. my problem is that not all the fields are required and the user may leave them empty.
then i want to insert values into tPerutim table in SQL server.
i wrote the folowing sql statement
Dim ShemPrati, ShemMishpacha As String
ShemPrati = txtShemPrati.Text
strSql = "Insert Into tPerutim " & _
"(Taz, ShemPrati) " & _
"Values " & _
"(" & txtTaz.Text & ", " & ShemPrati & ")"
the problem is that ShemPrati can be empty
and the statement is collapse
how can i fix it???
-
Re: sql insert problem
Either setup the field such that its not required, or use a RequiredFieldNavigator to ensure the user does enter something.
-
Re: sql insert problem
first thanks for the reply
the requiredfieldvalidator here is unacceptable because the field can be empty - its not required.
any other suggestions???
-
Re: sql insert problem
Before you perform your insert operation just check the textbox for null and if = null insert "".