[sql code]
create procedure numberofrows as declare @counter float set @counter = (select count(*) from testtable2) return @counter
[c# code]
...
SqlConnection cn = new SqlConnection(connectionString);
cn.Open();
MessageBox.Show("connection made");
SqlCommand storProc = new SqlCommand("numberofrows", cn);
storProc.CommandType = CommandType.StoredProcedure;
double result = storProc.ExecuteNonQuery();
textBox1.Text = result.ToString();
...
i believe ExecuteNonQuery() is the issue but i dont know what to replace it with.
Any help would be appreciated.

New Topic/Question
Reply



MultiQuote





|