>>>Naomi,
>>>What I am trying to say is, this is the recommended way for any backend (be it VFP, SQL server, Oracle,Access ...).
>>>If you do conversions yourself and put converted character value in command you might gain nanoseconds but then you have to know what each type of backend expects to see (for VFP you need {}, SQL server and many backends ODBC canonical format etc). With parametric approach you don't have to think about conversion. You can simply pass a date or datetime to both SQL server and Access with ?m.myDateOrDateTimeParameter.
>>>Cetin
>>
>>I agree with that you're saying. My only problem is that I'm not 100% convinced that Access is "smart enough" to do the necessary implicit conversion by itself. That's why I need someone to quickly try it, since I received an e-mail saying this approach didn't work and then did some research on the topic. I probably need to ask to install Access here fore me.
>>
>>
http://tek-tips.com/viewthread.cfm?qid=1266090>>
http://tek-tips.com/viewthread.cfm?qid=545746#postform>
>You sent irrelevant links (2nd wouldn't work as it exactly does the opposite of what I'm saying).
>So you were looking for a tester. OK I just tested this for you and it worked:
>
>ldStart = {^1996/08/01}
>ldEnd = {^1996/08/31}
>
>lcMDBDir = 'C:\Program Files\Microsoft Office\Office11\samples'
>lcMDBName = 'NORTHWIND.MDB'
>lnConnHandle = SQLSTRINGCONNECT('DSN=MS Access Database;DBQ='+;
> lcMDBDir+'\'+lcMDBName+';DefaultDir='+;
> lcMDBDir+';DriverId=25;FIL=MS Access;MaxBufferSize=2048;'+;
> 'PageTimeout=5;UID=admin;')
>
>myDate = DATE()
>*lcSQL = "select * from [Orders] where [RequiredDate] between ?ldStart and ?ldEnd"
>lcSQL = "insert into [Orders] ([orderid],[RequiredDate]) values (39999,?m.myDate)"
>? SQLExec(m.lnConnHandle, m.lcSQL)
>
>lcSQL = "select * from [Orders]"
>? SQLExec(lnConnHandle, lcSQL, 'MyResult')
>SQLDisconnect(lnConnHandle)
>SELECT myResult
>browse
>
Cetin,
This answers my doubts then. Thanks a lot.
If it's not broken, fix it until it is.
My Blog