G
Guest
I am trying to find out if any records were returned after a select. The
following code is what I am doing:
strSQL = "SELECT [med-id], [animal-id], [animal-name], medication, date,
dosage, frequeny, [vet-id], [veterinarian-name], notes FROM [medication]
Count WHERE [animal-id] = " + anum1;
cmSQL = new SqlCommand(strSQL, cnKennel) if (cnKennel.State !=
ConnectionState.Open)
cnKennel.Open();
drSQL = cmSQL.ExecuteReader();
if(drSQL.Read())
{
txtMedID.Text = drSQL["med-id"].ToString();
txtAnimalID.Text = drSQL["animal-id"].ToString();
txtAnimalName.Text = drSQL["animal-name"].ToString();
txtMedication.Text = drSQL["medication"].ToString();
txtDate.Text = drSQL["date"].ToString();
txtDosage.Text = drSQL["dosage"].ToString();
txtFreq.Text = drSQL["frequency"].ToString();
txtVetID.Text = drSQL["vet-id"].ToString();
gbVetName.Text = drSQL["veterinarian-name"].ToString();
txtMedNotes.Text = drSQL["notes"].ToString();
}
drSQL.Close();
Int32 count = (Int32)cmSQL.ExecuteScalar();
What am I doing wrong???
following code is what I am doing:
strSQL = "SELECT [med-id], [animal-id], [animal-name], medication, date,
dosage, frequeny, [vet-id], [veterinarian-name], notes FROM [medication]
Count WHERE [animal-id] = " + anum1;
cmSQL = new SqlCommand(strSQL, cnKennel) if (cnKennel.State !=
ConnectionState.Open)
cnKennel.Open();
drSQL = cmSQL.ExecuteReader();
if(drSQL.Read())
{
txtMedID.Text = drSQL["med-id"].ToString();
txtAnimalID.Text = drSQL["animal-id"].ToString();
txtAnimalName.Text = drSQL["animal-name"].ToString();
txtMedication.Text = drSQL["medication"].ToString();
txtDate.Text = drSQL["date"].ToString();
txtDosage.Text = drSQL["dosage"].ToString();
txtFreq.Text = drSQL["frequency"].ToString();
txtVetID.Text = drSQL["vet-id"].ToString();
gbVetName.Text = drSQL["veterinarian-name"].ToString();
txtMedNotes.Text = drSQL["notes"].ToString();
}
drSQL.Close();
Int32 count = (Int32)cmSQL.ExecuteScalar();
What am I doing wrong???