473,388 Members | 1,256 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

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

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


Nov 16 '05 #1
2 1416
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.
"Derrick" <de*********@excite.com> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
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



Nov 16 '05 #2
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.

"Derrick" <de*********@excite.com> wrote in message
news:##**************@tk2msftngp13.phx.gbl...
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



Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: J. Marshall Latham | last post by:
I have a simple page trying to enter three pieces of information into a database using ODBC on a web site that has .NET Framework 1.0, so I have to use this Microsoft.Data.Odbc.dll which has been...
2
by: Tony Epton | last post by:
<crossposted to several groups> Is there any way to create a DSNless connection to SQL server from access 97 (DAO) All the samples of connection strings I am finding - all have a reference to a...
2
by: Derrick | last post by:
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...
2
by: Robert Smith jr. | last post by:
Hello, Please pardon my newbie question ... I am building an ASP.NET page that displays a recordset with a Delete statement enabled (this all works fine). I want to Insert the current row...
4
by: MrsBean | last post by:
I've been working on learning how to use PHP with MS Access, and as long as I use ODBC, I can make it work. I want to use a DSNless connection. Everthing I have tried has failed. Can anyone show...
0
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in...
3
by: sammyloo | last post by:
Hi all, I'm experiencing a problem using ASP.NET web services to access a different server with SQL Server 2000 database. And I get the error of the following Exception Details:...
0
by: shapper | last post by:
Hello, I have the tables content and content_localized in a Microsoft Access database. I created a Query in my Microsoft Access database named "content_SELECT": SELECT...
5
by: trig | last post by:
Please help! I am an ICT teacher at a secondary school and my year 12 (AS Level) group need to create a website where data can be sent from a form to a Microsoft Access database. I am trying...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.