Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Microsoft Access DSNLess connection error, works fine in .ASP page, not in aspx code.

Reply
Thread Tools

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

 
 
Derrick
Guest
Posts: n/a
 
      08-26-2004
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








 
Reply With Quote
 
 
 
 
Derrick
Guest
Posts: n/a
 
      08-26-2004
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" <(E-Mail Removed)> wrote in message
news:%23%23j$(E-Mail Removed)...
> 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
>
>
>
>
>
>
>
>



 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      08-26-2004
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" <(E-Mail Removed)> wrote in message
news:##j$(E-Mail Removed)...
> 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
>
>
>
>
>
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd loyola Microsoft Certification 3 11-14-2006 05:18 PM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd realexxams@yahoo.com Microsoft Certification 0 05-10-2006 02:35 PM
microsoft.public.dotnet.faqs,microsoft.public.dotnet.framework,microsoft.public.dotnet.framework.windowsforms,microsoft.public.dotnet.general,microsoft.public.dotnet.languages.vb Charles A. Lackman ASP .Net 1 12-08-2004 07:08 PM
DSNLess troubles shank ASP General 4 07-17-2004 03:37 AM
perl as win32 and DSNless con to mdb? rob merritt Perl Misc 1 08-02-2003 12:32 AM



Advertisments