My stored procedure returns this
1 skl meter 50
I want my c# program to select the skl from the output.
I am currently doing this
SqlDataReader dr=comm.ExecuteReader();
var fal = dr.Read();
if (fal)
{
var skl = dr.GetString(1);
}
and it doesn’t work.
How would I select Skl or any other value from a sql output?
The problem is it selects skl even if skl isn’t present in the output
If your Procedure Returns more than 1 row of data, then I would suggest binding to a Datagrid.
This way you can also view the output and is a (ui) way of debugging.
Once you have the datagrid view showing your rows of data I would then do something like this:
But this is a long way of doing it and checking. To be Honest the method your using I think should work, Are you Receiving an error? or is the value wrong?