hello
i want to run this code,where all fields is not null then Query will be Executed,if not then message will be displayed
private bool IsValidationSuccess()
{
try
{
if (string.IsNullOrEmpty(txtCompanyName.Text.Trim())
&& string.IsNullOrEmpty(txtCompanyAddress1.Text) &&string.IsNullOrEmpty(txtPincode.Text.Trim())
&& cmbDistrict.SelectedIndex <=0 && cmbTaluka.SelectedIndex <=0)
{
return false;
}
else
{
return true ;
}
}
catch (SqlException ex)
{
throw ex;
}
//on button click
if (IsValidationSuccess())
{
AddCompanyDetails();
}
else
{
MessageBox.Show("Please fill Compulsary(*) field");
}
///////////////////////////////
error:when all field contain data it returns false,and message box is displayed .