HighTechTalks DotNet Forums  

Some help on using ODBC DSN and MS access

Dotnet Framework (ODBC.net) microsoft.public.dotnet.framework.odbcnet


Discuss Some help on using ODBC DSN and MS access in the Dotnet Framework (ODBC.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
joaotsetsemoita@gmail.com
 
Posts: n/a

Default Some help on using ODBC DSN and MS access - 07-24-2007 , 07:02 AM






Hi everybody,

Im trying to access a Ms Access database outside my root website
folder, so Im using ODBC DSN. I have already the DSN create and
working (this same DSN is used by many classic ASP websites I have
running on my remote server). Im also have latest ODBC and JET
drivers
installed.


My code is something like this:


Dim objConn As New OdbcConnection
objConn.ConnectionString = "DSN=MyDSN;"


objConn.Open()


Const strSQL As String = "SELECT * FROM customers"
Dim objCmd As New OdbcCommand(strSQL, objConn)


However when I try to run this I always get the error "ERROR [IM002]
[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified" on the line that opens the connection ->
objConn.Open()


Any sugestion why is this happening? Or perhaps some turnaround on
how
to access a MS Access database that is outside my root webfolder.


Any help is higly appreciated


Thanks in advance


Joao


Reply With Quote
  #2  
Old   
Paul Clement
 
Posts: n/a

Default Re: Some help on using ODBC DSN and MS access - 07-25-2007 , 08:53 AM






On Tue, 24 Jul 2007 05:02:43 -0700, joaotsetsemoita (AT) gmail (DOT) com wrote:

¤ Hi everybody,
¤
¤ Im trying to access a Ms Access database outside my root website
¤ folder, so Im using ODBC DSN. I have already the DSN create and
¤ working (this same DSN is used by many classic ASP websites I have
¤ running on my remote server). Im also have latest ODBC and JET
¤ drivers
¤ installed.
¤
¤
¤ My code is something like this:
¤
¤
¤ Dim objConn As New OdbcConnection
¤ objConn.ConnectionString = "DSN=MyDSN;"
¤
¤
¤ objConn.Open()
¤
¤
¤ Const strSQL As String = "SELECT * FROM customers"
¤ Dim objCmd As New OdbcCommand(strSQL, objConn)
¤
¤
¤ However when I try to run this I always get the error "ERROR [IM002]
¤ [Microsoft][ODBC Driver Manager] Data source name not found and no
¤ default driver specified" on the line that opens the connection ->
¤ objConn.Open()
¤
¤
¤ Any sugestion why is this happening? Or perhaps some turnaround on
¤ how
¤ to access a MS Access database that is outside my root webfolder.


What happens if you use a DSN-less connection (with Jet OLEDB) instead of a DSN (and ODBC)? Jet
OLEDB is the preferred method as it provides better feature support and is the more stable
technology.


Paul
~~~~
Microsoft MVP (Visual Basic)

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.