Is this possible or the right way to go about this (if you're not using a stored proc):
conn.CommandText = "set @TotalPts = select SUM (pts) from cars where completedDate is not null and customerID = @customerID";
conn.AddParam("@customerID", customerID);
conn.AddOutputParam("@TotalPts", SqlDbType.Int);
return (int)conn.OutputParamValue;
I want to get back the sum so I can return it in my C# method. I'm not sure how to set the output param in the string.