PDA

Click to See Complete Forum and Search --> : what is wrong here ??


David Laplante
Aug 29th, 2000, 08:40 AM
can someone tell me what is wrong here?? (this is connected to a ms sql database throught ODBC


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

kovan
Aug 29th, 2000, 08:55 AM
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..

Stevie
Aug 29th, 2000, 09:16 AM
Give this a go ...


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