Microsoft Access DSNLess connection error, works fine in .ASP page, not in aspx code.

D

Derrick

Trying this code in the Page_Load of a C# web page...

private void Page_Load(object sender, System.EventArgs e)
{
string connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\\MyAccessDb.mdb;";
OdbcConnection conn = new OdbcConnection(connstr);
conn.Open();
...

Throws this error
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found
and no default driver specified

But the same connection string works fine in a regular ol' ASP page, any
ideas?

Thanks!

Derrick
 
D

Derrick

and let me clarify, the same connection below string works fine in asp page
when creating an ADO.Recordset object and then setting the below
connectionstring as the ActiveConnection prop.
 
K

Kevin Spencer

The connection string is fine. It's the rest of your code that is the
problem. Try using the .Net OleDb classes instead.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top