>Dear Experts,
>
>I m trying to use dateadd, But its giving error as follows.
>
>Select Prodno From Stock where dateadd(MM,1,getdate())
>
>
>'Error number 1526 Message connectivity error [Microsoft] ODBC Sql Server Driver,
>Line 1 Incorrect Syntax Near ')' '.
>
>The purpose is i want to take the report of all product which will going to expire
>after next 1 month from the date of current month.
>
>Eg. Suppose today is '08/11/2005'
>i want to dispaly all prodcts on expiry date of '08/12/2005'Abdulla
Why do it this way? If I understand correctly you want to run a VFP8 command to get data fromSQL Server for a certain date. Just build the command directly:
cServerName=""
cDatabaseName=""
cConnString="Driver={SQL Server};" +;
"Server="+cServerName+";" +;
"Database="+cDatabaseName+";" +;
"Trusted_Connection=yes"
nHandle = SQLStringConnect(cConnString)
cExpDate = DTOC(DATE()+1)
cSQL = "Select Prodno From Stock where ExpDate='"+cExpDate+"'")
nResult = SQLExec(nHandle,cSQL)
In your original query above you do not state the ExpDate field name.
Note: for connection string info see:
http://www.carlprothman.net/Default.aspx?tabid=81