aderes Posted December 28, 2005 Posted December 28, 2005 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! Quote
Administrators PlausiblyDamp Posted December 28, 2005 Administrators Posted December 28, 2005 Probably because it isn't an access database, it is probably a SQL Express database. Try using the SQLCLient.Connection to connect instead. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.