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

sql/session variables

Status
Not open for further replies.

kkondrat

MIS
Aug 6, 2001
1
US
Here is my code:

If Session("departmentnum") > "0" Then
Query = "SELECT UserName, pass, UserID "
Query = Query & "FROM Securities "
Query = Query & "WHERE DepartmentID =" & Session("departmentnum")
response.write Query
End If
Set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.Open "DSN=kevincar", "CARDoc"
Set RSlist = Server.CreateObject("ADODB.recordset")
RSlist.Open Query,DataConn,3,3


Here is my error message:

SELECT UserName, pass, UserID FROM Securities WHERE DepartmentID =3
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

[Microsoft][ODBC Microsoft Access 97 Driver] Too few parameters. Expected 1.

/car/currentCars.asp, line 11
 
usually that error means there is a typo in your sql statement.

check to make sure that all the columns in that table exist.. another possible error might be the pass column.

try encapsulating it in [] brackets to make sure that it gets seen as a column.

eg: [pass]

hth
leo
 
Yes, The problem is the sql statement, yes I know, but what I don't know is how to get the session variable = the recordsetID(departmentID)

The session variable = "a number"
the department ID = "a number"

I know my syntax is wrong with the quotes and parenthesis, my problem is passing variables between forms, please help, thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top