Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hey guys,

I'm having some problems connecting to a database made inside of Visual Web Developer 2005 Express Edition. Every time I run the webpage, I get an error (Unrecognized database format 'C:\Documents and Settings\Owner\My Documents\Visual Studio 2005\WebSites\WebSite2\App_Data\sites.mdf'). It's driving me nuts! Any ideas?

 

Here's a snip of the connection code.

 

DataTable dt = new DataTable();

DataSet ds = new DataSet();

OleDbDataAdapter da = new OleDbDataAdapter();

OleDbConnection con = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=C:/Documents and Settings/Owner/My Documents/Visual Studio 2005/WebSites/WebSite2/App_Data/sites.mdf;");

OleDbCommand cmd = new OleDbCommand(sql, con);

da.SelectCommand = cmd;

da.Fill(ds);// errors out here (Unrecognized database format )

dt = ds.Tables[0];

 

return dt;

 

Thanks guys!

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...