I am wondering if there is any way to execute multiple SQL statements. Like I want to get count as well as the value. How can I do this in c#?
Query 1:
cmd = new SqlCommand("select count(*) from tblStock where prodName=@prodName", con); // to get count
Query 2:
cmd = new SqlCommand("select quantity from tblStock where prodName=@prodName", con);// to get qty
int count, qty;
try
{
con.Open();
count = (Int32)cmd.ExecuteScalar(); //returns null if doesnt exist
qty = (Int32)cmd.ExecuteScalar();
}
Is it possible?