Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Posted
from what i understand, that should bring me to the db4 file in the folder fin which the asp page is in on the server. im prob wrong though as i really dont understand mappath() . il mess with that. thanks

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...