Hi

i am converting an asp ecommerce site to use mySQL instead of access

i am mostly doing ok but have run into this problem with the SQL used to check a voucher code is valid - ie to check it is within date

here is the original asp / access code:


<&#37;
Dim VouchersRS__param1
VouchersRS__param1 = "0"
If (Request("Voucher") <> "") Then
VouchersRS__param1 = Request("Voucher")
End If
%>
<%
Dim VouchersRS
Dim VouchersRS_numRows

Set VouchersRS = Server.CreateObject("ADODB.Recordset")
VouchersRS.ActiveConnection = MM_Cart_STRING

VouchersRS.Source = "SELECT * FROM emporium.vouchers WHERE (((DateDiff('d',[StartDate],date()))>=0) AND ((DateDiff('d',[EndDate],date()))<=0)) and VoucherCode='" + Replace(VouchersRS__param1, "'", "''") + "'"

VouchersRS.CursorType = 0
VouchersRS.CursorLocation = 2
VouchersRS.LockType = 1
VouchersRS.Open()

VouchersRS_numRows = 0
%>


here is the error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE (((DateDiff('d',[StartDate],GetDateTime))>=0) AND ((DateDiff('d',[EndDate]' at line 1



can anyone help?

thanks
ian