I believe this is very simple, but I have spent a while Googling and looking at available API and I have not found a solution yet.
I simply need to get a data element (a double, in this case) from a known SQL table, when I know the Column and Row to get the data from, into my C# code. For simplicity, let's say my table has 3 columns: ProductID, Price, and Weight. I have access in my C# code to the ProductID, and I made a string which is the ProductID. Now I simply need to get that ProductIDs corresponding Price into a double in my C# code.
I am brand new to SQL, but I believe a pseudoquery would be something like:
SELECT Price FROM tablename WHERE ProductID=id
Not too worried about the query (but I would appreciate help with that as well). I just really need to know how to make a double in C# equal to that specific data element in the SQL table. It should be dead simple, but I am making it harder than it is. Here is some of the C# code so far:
SqlCommand sqlcommand = new SqlCommand("SELECT Price FROM tablename WHERE ProductID=id");
double ItemPrice = sqlcommand.GetData;