Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Vfp's GOMONTH()command equalant to SQL server Command.
Message
From
08/11/2005 06:59:48
 
 
To
08/11/2005 06:36:24
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01066323
Message ID:
01066366
Views:
25
>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=""    && fill in properly
cDatabaseName=""  && fill in properly
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


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Previous
Reply
Map
View

Click here to load this message in the networking platform