-
can someone tell me what is wrong here?? (this is connected to a ms sql database throught ODBC
Code:
rstCheckupCheques.Open "SELECT * FROM Cheque " & _
"WHERE Cheque_Recipient = '" & Recipient & _
"' AND Cheque_Date = #" & CDate(GetCgiValue("Cheque_Date")) & _
"# AND Cheque_Address = '" & Address & _
"' AND Cheque_Amount = " & Amount & _
" AND Cheque_Description = '" & Description & _
"' AND Cheque_FileNo = '" & FileNo & _
"' AND Cheque_Branch = '" & ChequeBranch & "'", DBConnection, adOpenStatic
I get the folowing error:
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '#'. Error Number = -2147217900
I checked and GetCgiValue("Cheque_date") is not null or empty... it is a valid date
thanks
-
try
try a DATE instead of a variable
like type 02/02/02 there and see if its a sql problem or if its the variable..
-
Give this a go ...
Code:
rstCheckupCheques.Open "SELECT * FROM Cheque " & _
"WHERE Cheque_Recipient = '" & Recipient & _
"' AND Cheque_Date = #" & Format(CDate(GetCgiValue("Cheque_Date")), "mm/dd/yyyy") & _
"# AND Cheque_Address = '" & Address & _
"' AND Cheque_Amount = " & Amount & _
" AND Cheque_Description = '" & Description & _
"' AND Cheque_FileNo = '" & FileNo & _
"' AND Cheque_Branch = '" & ChequeBranch & "'", DBConnection, adOpenStatic