>Cetin,
>
>>Why are you trying to create such a string in the first place? Is it a cursoradapter or SQLExec() string? If so you better use parametric insert. ie:
>>
>>cInsertCommand = "insert into mytable (mydtfld) values (?m.ltDatetime)"
>>m.ltDatetime = datetime()
>>SQLExec(m.lnHandle, m.cInsertCommand)
>>
>
>I am trying to create a 3-tier application where the UI tier passes an array of field/value pairs to the Data Access tier. Then in the Data Access tier I need to update database, either VFP or SQL Server. So I am experimenting with different approaches. I use SQLExec for the SQL Server, by the way, not a cursoradapter. So, for the VFP database, I was building this long string of fields and values. I am trying to make the routine somewhat generic, that's why I was building the Insert string in the Data Access tier.
>
>If you see that I am not on the right track with this approach, please let me know. Thank you.
For SQL server see the parametric approach. It also handles headaches for conversion if field on VFP side is either date or datetime. ie:
cInsertCmd = "insert into myTable (f1, f2, f3) values (?m.Value1, ?m.Value2, ?m.Value3)"
SQLPrepare(m.lnHandle,m.cInsertCmd)
m.ldStart=date()
for ix=1 to 5
m.Value1 = cdow(m.ldStart+m.ix-1)
m.VAlue2 = m.ldStart + m.ix - 1
m.Value3 = datetime() - (m.ix * 3600)
SQLExec(m.lnHandle)
endfor
Cetin