Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date range from Vfp Table via OLeDB
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01520274
Message ID:
01520332
Vues:
39
Ah ok. :)


>Hi Mark.
>Thanks for replying.
>I eventually got it to work... I had been coding in named paramneters .OLEDB does not allow named parameters and this was most of my problem, so I had to use ? as positional parameters
>Regards,
>gerard
>
>
>
>>>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform