i am working on a validation but it gives me an error that "operator && cannot be applied to bool"..
if (txt_Name.Text != "" && txt_State.Text != "") { cmd = new SqlCommand("insert into tbl_Record(Name,State) values(@name,@state)", con); con.Open(); cmd.Parameters.AddWithValue("@name", txt_Name.Text); cmd.Parameters.AddWithValue("@state", txt_State.Text); cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("Record Inserted Successfully"); DisplayData(); ClearData(); } else { MessageBox.Show("Please Provide Details!"); }
Please guide me how to fix it???