Creating a method to retun a vaule from an SQL query
Posted on 2004-09-24
I’m trying to create a method so that when it is called, it will return a value based on what it received. Here is what I have come up with so far. I guess you could say I'm still a C# dummy.
private void GetProductPrice(int productID)
strSQL = "SELECT product_price from t_products where product_id =productID";
cnSQL = new SqlConnection(Connectionstring);
cmSQL = new SqlCommand(strSQL, cnSQL);
drSQL = cmSQL.ExecuteReader();
return drSQL.?????; //at this point I'm not sure how to return a value to the method that invoked it.