my database is in the same folder as my asp page, so i use the mapPath function to try to connect to it using the line:
conn1 = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath(".")+ "/db4.mdb");
i then have the the two lines following it:
sql = new System.Data.OleDb.OleDbCommand ("select username,password from users");
this.conn1.Open();
this.dataReader = new OleDbDataReader();
dataReader = sql.ExecuteReader();
it all seems correct to me but i keep getting this error, which i can make no sense of:
System.InvalidOperationException: ExecuteReader: Connection property has not been initialized. at System.Data.OleDb.OleDbCommand.ValidateConnectionAndTransaction(String method, Int32& localState) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.OleDb.OleDbCommand.ExecuteReader() at Upload.Logon.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\upload\logon.aspx.cs:line 72
any ideas at all.its been wrecking my head for two hours now.
conn1 = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath(".")+ "/db4.mdb");
i then have the the two lines following it:
sql = new System.Data.OleDb.OleDbCommand ("select username,password from users");
this.conn1.Open();
this.dataReader = new OleDbDataReader();
dataReader = sql.ExecuteReader();
it all seems correct to me but i keep getting this error, which i can make no sense of:
System.InvalidOperationException: ExecuteReader: Connection property has not been initialized. at System.Data.OleDb.OleDbCommand.ValidateConnectionAndTransaction(String method, Int32& localState) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.OleDb.OleDbCommand.ExecuteReader() at Upload.Logon.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\upload\logon.aspx.cs:line 72
any ideas at all.its been wrecking my head for two hours now.