Sunday 23 September 2012

The Connection Was Not Closed. The Connection's Current State Is Open

InvalidOperationException, The Connection Was Not Closed. The Connection's Current State Is Open- Actually I Want To Retrieve Data From Database,So i Had taken A Button "btnRetrieve" And I Had Taken An Event "btnRetrieve_Click" And Write The Code To Retrieve Data From The Database..All Is Fine In This Event And No Errors Occurred.
       Now I Need To Retrieve Data From The Database At The Time Of  Typing The Text In The TextBox.  So That  I Had Taken An Event  "txtFirstname_TextChanged". In That TextBox Event I Wrote A Function To Call The "btnRetrieve_Click" Event. The Code Is Compiled Well And Execution Started. But At The Time Of Typing The Text In The TextBox..It Showed The Exception "InvalidOperationException, The Connection Was Not Closed. The Connection's Current State Is Open".
       At The Time Of Button Click Event i.e. "btnRetrieve_Click", It Works Successfully, But Here In TextBox Event i.e."txtFirstname_TextChanged", It Is Showing Exception.


But What I Recognized is That The Text That I Am Typing In The TextBox Should Be Case Sensitive. If The Data in The Database Is In CAPITAL Letters, Then The Text We Are Typing Should Also Be In Capital Letters. It The Text is in Small Letters,Then The Typing Text is Also in Small Letters.or If The Text That We Are Typing Having FirstLetter Capital And Remaining Letter Are Small, Then We Have To Type Like That Only..
If Any Body have Better Solution Than This.You Can Give Me Solution.. ThanQ..

No comments:

Post a Comment

Note: only a member of this blog may post a comment.