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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data source name too long

Status
Not open for further replies.

dhaveedh

Programmer
Aug 13, 2003
112
GB
Can anyoe tell me why i get the error message;
Data source name too long with this piece of code?


<%
Response.Buffer = True

strUser = Request.ServerVariables(&quot;LOGON_USER&quot;)

' *********
Dim sDSNFile
Dim sPath, sDSN

sDSN = Server.MapPath(&quot;c:\windows\testme\employees\EmpComms.txt&quot;)

Dim conn, rs
Set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)

conn.Open sDSN

Dim sql

sql = &quot;SELECT User FROM EmpComms.txt WHERE User = strUser&quot;
set rs = conn.execute(sql)

Do While Not rs.EOF

if strUser <> User then

end if

Loop

rs.close
set rs = nothing
conn.close
set conn = nothing

KISS - Keep It Simple Sugar!
 
This code causes the problem:
Code:
sDSN = Server.MapPath(&quot;c:\windows\testme\employees\EmpComms.txt&quot;)
Try changing it to:
Code:
sDSN = &quot;Provider=Microsoft.Jet.OLEDB.4.0;&quot; & _
       &quot;Data Source=c:\windows\testme\employees&quot; & _
       &quot;;Extended Properties='text;FMT=Delimited'&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top