>I have a C# program set up to extract data froma VFP table via OLEDB.
> I can seelct data fine, but if i try to use a data range in the select, I am getting errors when I run the select command.
> I have tried a few options , inserting into the select string, using parameters, but none are sucessful.
>
>Anybody know the correct syntax to e.g. Select from MyTable where Fld_date = ParamDate
>Tia
>Gerard
This works for me in Excel VBA. As far as the date format is concerned, it should be the same in .net.
{^yyyy-MM-dd}, ie {^2011-08-06} for today.
Sub connectRough()
Dim cDBC As String: cDBC = "C:\data\plucz\plucz.dbc"
Dim pADOConn As New ADODB.Connection
pADOConn.Open "Provider=VFPOLEDB; Data Source= " & cDBC & ";Password='';Collating Sequence=MACHINE"
Dim mrs As New ADODB.Recordset
Dim d As Date: d = DateSerial(2008, 12, 8)
Dim cSQL As String: cSQL = "select * from badge where bdg_creationdate = {^" & Format(d, "yyyy-MM-dd") & "}"
mrs.Open cSQL, pADOConn
Debug.Print mrs("bdg_name")
End Sub
If things have the tendency to go your way, do not worry. It won't last. Jules Renard.