using (SqlConnection con = new SqlConnection(CS))
{
con.Open();
SqlCommand cmd = new SqlCommand("Select Distinct DoctorName from DoctorNames where DoctorName='"+txtDocName.Text+"'", con);
SqlDataReader dr = cmd.ExecuteReader();
if (!dr.Read())
{
DialogResult result = MessageBox.Show("You entered new Dontor's Name, do you want to add it in database?", "Dentco Dental Lab", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
switch(result)
{
case DialogResult.Yes:
break;
case DialogResult.No:
break;
}
}
}
{
con.Open();
SqlCommand cmd = new SqlCommand("Select Distinct DoctorName from DoctorNames where DoctorName='"+txtDocName.Text+"'", con);
SqlDataReader dr = cmd.ExecuteReader();
if (!dr.Read())
{
DialogResult result = MessageBox.Show("You entered new Dontor's Name, do you want to add it in database?", "Dentco Dental Lab", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
switch(result)
{
case DialogResult.Yes:
break;
case DialogResult.No:
break;
}
}
}
No comments:
Post a Comment