[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

Some help on using ODBC DSN and MS access

joaotsetsemoita

7/24/2007 12:03:00 PM

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

1 Answer

Paul Clement

7/25/2007 1:53:00 PM

0

On Tue, 24 Jul 2007 05:02:43 -0700, joaotsetsemoita@gmail.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)