Click here to Skip to main content
15,907,687 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Am displaying data in a List View. But at the line lv.Show(); I get an error message “ExecuteReader requires an open and available connection”
Please what should I do?
C#
public bool searchpersonDetails(string personid, string personname)
{
  conn.Open();
  if (client_id == null)
  {
    Fom1 lv = new Fom1(personname);
    lv.Show();
  }
}
Posted
Updated 8-Jan-12 6:08am
v3

Most likely the problem is inside the Form1 classes code. Put a breakpoint and then press F11 (step into) to see what's going on in there. Somewhere in there you use a reader without an open connection.
 
Share this answer
 
judging by the error message you may have not closed the connection anywhere in Form1 .You can easily resolve this by debugging as suggested by mika.

hope it helps :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900