Hi Everyone,
ColumnName DataType Length AllowNulls
sampleKey char 10
engDesc char 40 Yes
frDesc char 40 Yes
When I try to add a record,if the Textbox is empty then I am getting an errror. If it's not empty then it adds to the table. But in database, I checked those fields to accept null values. Here is the sample code below.
<VBCODE>
Dim sqlQuery as String = "INSERT INTO SampleTable(sampleKey,engDesc,frDesc) VALUES (@key,@english,@french)"
Dim cmd As SqlCommand = SqlConnection1.CreateCommand
cmd.Parameters.Add("@key", txtKey.Text)
cmd.Parameters.Add("@english", txtEnglish.Text)
cmd.Parameters.Add("@french", txtFrench.Text)
cmd.CommandType = CommandType.Text
cmd.CommandText = sqlQuery
SqlConnection1.Open()
cmd.ExecuteNonQuery()
SqlConnection1.Close()
</VBCODE>