Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL syntax problems w/ OLEDB provider?
Message
From
27/04/2004 08:58:56
 
 
To
27/04/2004 08:51:22
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00898465
Message ID:
00898472
Views:
13
>>Can someone help me with a problem I am having with an adodb sql statement?
>>The following lines work fine in the vfp command window:
>>
>>
>>xStartTime = CTOT("04/25/04 07:00:00")
>>xEndTime = CTOT("04/25/04 17:00:00")
>>SELECT * from meetings WHERE BETWEEN(starttime,xStartTime,xEndTime)
>>
>>
>>the SELECT statement returns all of the records whose StartTimes are between xStartTime and xEndTime.
>>
>>But when I attempt to use the statement in the context of adodb I hit the wall.
>>For example:
>>
>>
>>oConnection = CREATEOBJECT("adodb.connection")
>>oConnection.ConnectionString="Provider=VFPOLEDB.1;data source=C:\Inetpub\wwwroot\2004_gmg\data\Appointments.dbc"
>>Connection.Open()
>>oConnection.Errors.Clear()
>>
>>
>>No matter how I build mySQL I seem to get it wrong:
>>
>>mySQL =  "SELECT * from meetings WHERE BETWEEN" + "(" + "StartTime" +;
> ", "  +  TRANSFORM(xStartTime) + ", " + TRANSFORM(xEndTime) + ")"
>>rs=oConnection.Execute(mySQL)
>>? rs.GetString()										
>>RELEASE oConnection
>>
>>
>>This generates an error stating that a function is missing a “)”. But nothing I attempt works.
>>
>>Please assist me in the proper syntax of mySQL to pass into oConnection.Execute.
>>Thank you
>>Neil
>
>
>xStartTime = "^2004/04/25 07:00"
>xEndTime   = "^2004/04/25 17:00"
>mySQL =  "SELECT * from meetings WHERE StartTime BETWEEN "+;
> "ctot(xStartTime) and ctot(xEndTime)"
>rs=oConnection.Execute(mySQL)
>? rs.GetString()										
>RELEASE oConnection
>
Cetin
Previous
Reply
Map
View

Click here to load this message in the networking platform