Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC -- Connection to <DSN Name> failed.

Status
Not open for further replies.

oakfish

Programmer
Nov 13, 2001
5
0
0
US
Hi there. I am having problems connecting to an older ( version unknown) FoxPro database through an ASP page. I tried using a DSNless connection, then tried again with various DSNs through a MS Access database. For example, the code below shows my attempt to connect to a MS Access database names ProjFinance through a DSN named "ProjFinance." The Access DB has links to the FoxPro tables. On my laptop, the tables open fine. Then when the web page tries to open the recordset through the second DSN used by Access to connect to the FoxPro tables, the connection fails. Any ideas?

----Begin code----------
Dim conn, stconn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DSN=ProjFinance"
'---Comments blow are ealier attempts
'conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;
'Data Source=\\accounting\sema4\data\ProjFinance.mdb"
'conn.Open "Driver={Microsoft Visual FoxPro Driver};" & _
' "SourceType=DBC;" & _
' "SourceDB=\\accounting\sema4\data\S4DBC.DBC;" & _
' "Exclusive=No"
%>
<%
Dim rs, strQuery, cmdTemp
Set cmdTemp = Server.CreateObject(&quot;ADODB.Command&quot;)
Set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
strQuery = &quot;SELECT time.timproj, employee.empsname, &quot; + _
&quot;time.timpe, time.timbrate, time.timwhrs, time.timbhrs, [timbrate]*[timwhrs] AS wamt, &quot; + _
&quot;[timbrate]*[timbhrs] AS bamt &quot; + _
&quot;FROM employee INNER JOIN [time] ON employee.empidno = time.timemp &quot; + _
&quot;WHERE (((time.timproj)='12-0009'));&quot;
cmdTemp.CommandText = strQuery
cmdTemp.CommandType = 1 'SQL statement
Set cmdTemp.ActiveConnection = conn
rs.CacheSize = 10
rs.Open cmdTemp,,adOpenStatic
 
Related post with more clear description of the problem

thread706-243696
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top