If TextBox1.Text Is Nothing Then cmd = New SqlCommand("insert into sample values('" + DropDownList1.SelectedItem.Text + "')") Else cmd = New SqlCommand("insert into sample values('" + TextBox1.Text + "')") End If cmd.ExecuteNonQuery ()
if (TextBox1.Text.Trim() != string.Empty) { //The text box is not empty so let us use this value to push in DB } else { string valueToPush = DropDownList1.SelectedValue; //Now push this value in the DB }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)