ODBC error 80040e10

ODBC error 80040e10

Post by dan » Thu, 21 Aug 2003 02:30:20


I get the above error message returned on the following
segment of code in my SQL statement:

SQL = " SELECT * FROM Trainers WHERE (TATOD is Null AND
NatTr is Null AND TTMTONLT is Null AND TTMNLE is Null) AND
((RotatTTM is Null) OR ((RotatTTM = 1) AND (RTTBID >
#01/01/01#))) ORDER BY Trainers.LocCity, Trainers.Tname "

Set rs=Server.CreateObject("ADODB.RecordSet")
rs.CursorLocation = adUseClient
rs.CursorType = adOpenStatic
rs.LockType = adLockOptimistic
rs.Open SQL, MyDSN
Set rs.ActiveConnection = Nothing


The error returns on the "rs.Open SQL, MyDSN" line. It
says "Too few parameters. Expected 1."
 
 
 

ODBC error 80040e10

Post by Alok Agarw » Fri, 22 Aug 2003 21:24:14

Hello Dan,

Actually instead of dataSource Name you need to specify
the connection object name as shown below.

First declare a connection object in a bas module.

Dim gconDBConn as new ADODB.Connection

Public Sub MakeConnection()
With gconDBConn
.Provider = "MSDASQL"
.CursorLocation = adUseClient
.Properties("Data Source") = "Some DSN Name"
.Open
End With
End Sub


After making a call to MakeConnection , you should now use

...
...
...
rs.Open SQL, gconDBConn

Appreciate if you could please let me know whether the
problem was solved.

Thanks
Alok Agarwal


AND