c# - System.InvalidOperationException: -


    protected void btnlogin_click(object sender, eventargs e)     {         string id = request.form["txtid"];         string password = request.form["txtpassword"];         string strconstring = configurationmanager.connectionstrings["soconnectionstring"].connectionstring;         oledbconnection conn = new oledbconnection(strconstring);         oledbcommand cmd = new oledbcommand("select * usermaster userid =" + id + "");          try         {             // clientscript.registerstartupscript(this.gettype(), "yourmessage", "alert('" + id + " " + password + "');", true);             conn.open();             oledbdatareader dr;              dr = cmd.executereader();             txtid.text = "test1";             //txtpassword.text = dr["userpwd"].tostring();             //oledbdatareader dr;             //while (dr.read()){             //    clientscript.registerstartupscript(this.gettype(), "yourmessage", "alert('" + id + " " + password + "');", true);             //    txtpassword.text = dr["userpwd"].tostring();             //}          }         catch (exception ex)         {             txtid.text = "ex";             lbltest.text = ex.tostring();           }                 {             conn.close();             conn.dispose();         } 

exception:

system.invalidoperationexception: executereader: connection property has not been initialized. @ system.data.oledb.oledbcommand.validateconnection(string method) @ system.data.oledb.oledbcommand.validateconnectionandtransaction(string method) @ system.data.oledb.oledbcommand.executereaderinternal(commandbehavior behavior, string method) @ system.data.oledb.oledbcommand.executereader(commandbehavior behavior) @ system.data.oledb.oledbcommand.executereader() @ _default.btnlogin_click(object sender, eventargs e) in c:\users\b2patso\desktop\so maintainance\default.aspx.cs:line 29

anyone know how problem? using asp.net c# , visual studio 2013. db oracle

try oledbcommand cmd = new oledbcommand("select * usermaster", conn);


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -