Wacky ODBC connect issue

  • Thread starter Thread starter Earl
  • Start date Start date
E

Earl

Maaaaaaaaaan ... nothing but drama with ODBC and .Net.

On my development system, using the code below, I can successfully open/read
an Act.dbf file. I can successfull do this either in debug mode or simply
running the program.exe.

However, on the user systems, I get the error:
"Error [IM002] Microsoft [ODBC Driver Manager] Data Source name not found
and no default driver specified."

(Note that ActDBSource is the path that comes in from a class where it has
been set by the user and ActDBName is simply the split/parsed value of name
only, 'i.e., Your.Dbf.) Not only have I examined both of those strings, but
they also work properly on the development system, thus I do not believe
either is an issue.)

On my test systems where this is failing, I do have the DSN for Visual
FoxPro Tables. If this is a system issue, I'm scratching my head on what's
not configured properly.

'***************************************
Imports System
Imports System.Data.Odbc

Dim connAct As New Odbc.OdbcConnection
connAct.ConnectionString = "PWD=;SourceType=DBF;DSN=Visual FoxPro Tables;" &
_
"Collate=Machine;BackgroundFetch=Yes;Exclusive=No;" & _
"SourceDB=" & ActDbSource & ";" & _
"UID="
Dim strProspectSelect As String = "Select
Name,Home_Phone,Fname,LName,Unique_ID FROM " & "[" & ActDbName & "]"
Dim cmdProspects As New OdbcCommand(strProspectSelect, connAct)
Dim dr As OdbcDataReader
connAct.Open()
dr = cmdProspects.ExecuteReader()
 
Sigh. I thought when we went to ADO.NET native providers we would see the
end of ODBC connect strings...
This type of exception is typically caused by an incorrectly registered DSN.
Remember the DSN must be registered on the system that opens the
connection--this is not necessarily the client application. Over the years
we generally moved away from registered DSNs and went to DSN-less or
File-based DSNs in connection strings. Check out Carl Prothman's connection
strings site for examples.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Thanks Bill. Unfortunately, until Act provides a .Net provider, it looks
like I'm stuck with this nonsense. The DSNs looked correct on the client
system, but I must be overlooking something.

William (Bill) Vaughn said:
Sigh. I thought when we went to ADO.NET native providers we would see the
end of ODBC connect strings...
This type of exception is typically caused by an incorrectly registered DSN.
Remember the DSN must be registered on the system that opens the
connection--this is not necessarily the client application. Over the years
we generally moved away from registered DSNs and went to DSN-less or
File-based DSNs in connection strings. Check out Carl Prothman's connection
strings site for examples.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Earl comcast net> said:
Maaaaaaaaaan ... nothing but drama with ODBC and .Net.

On my development system, using the code below, I can successfully open/read
an Act.dbf file. I can successfull do this either in debug mode or simply
running the program.exe.

However, on the user systems, I get the error:
"Error [IM002] Microsoft [ODBC Driver Manager] Data Source name not found
and no default driver specified."

(Note that ActDBSource is the path that comes in from a class where it has
been set by the user and ActDBName is simply the split/parsed value of name
only, 'i.e., Your.Dbf.) Not only have I examined both of those strings, but
they also work properly on the development system, thus I do not believe
either is an issue.)

On my test systems where this is failing, I do have the DSN for Visual
FoxPro Tables. If this is a system issue, I'm scratching my head on what's
not configured properly.

'***************************************
Imports System
Imports System.Data.Odbc

Dim connAct As New Odbc.OdbcConnection
connAct.ConnectionString = "PWD=;SourceType=DBF;DSN=Visual FoxPro
Tables;"
&
_
"Collate=Machine;BackgroundFetch=Yes;Exclusive=No;" & _
"SourceDB=" & ActDbSource & ";" & _
"UID="
Dim strProspectSelect As String = "Select
Name,Home_Phone,Fname,LName,Unique_ID FROM " & "[" & ActDbName & "]"
Dim cmdProspects As New OdbcCommand(strProspectSelect, connAct)
Dim dr As OdbcDataReader
connAct.Open()
dr = cmdProspects.ExecuteReader()
 
Back
Top