I tried this code to extract a single value from my database and store it in a variable. But it extracts the value Supplier ID
instead of Quantity
.
string query3 = "SELECT Quantity FROM Supplier WHERE [Supplier ID]='"+supplierid+"'"; SqlCommand cmd3 = new SqlCommand(query3, con); con.Open(); string temporaryquantity = cmd.ExecuteScalar().ToString(); MessageBox.Show(temporaryquantity);
How can I extract Quantity
instead of Supplier ID
?
#c-sharp #sql #database