Visual Studio: A severe error occurred on the current command. The results, if any, should be discarded

Viewed 25

I get this error when trying to execute my SQL Server stored procedure:

A severe error occurred on the current command. The results, if any, should be discarded.

Code:

dataGridView1.Rows.Clear();

int i = 0;

cn.Open(); // this code where the error show up 
cm = new SqlCommand("select * from tblay", cn);
dr = cm.ExecuteReader();

while (dr.Read())
    // *data reader*
  
0 Answers
Related