Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert dates into VFP via ADODB

Status
Not open for further replies.

wsobers

IS-IT--Management
Dec 2, 2000
43
BB
I have to update/insert records into a VFP free table.
Code follows below...

Dim Conn As Variant
Dim sql_cmd As String, qry_cmd As String
'
Set Conn = CreateObject("ADODB.Connection")
Conn.Mode = 16 ' ShareDenyNone
Conn.CursorLocation= 3 'Client Side Cursor
Conn.Open "Provider=VFPOLEDB;Data Source=E:\RETAIL\DATA\"
'
sql_cmd = "insert into xrtlparts (" & cInsertFields & ") values (" & cInsertValues & ")"

Dim objRS As Variant
Set objRS = CreateObject("ADODB.RecordSet")
Set acmd = CreateObject("ADODB.Command")
'
acmd.CommandText = sql_cmd
Set acmd.ActiveConnection = Conn
'
Set objRS = acmd.Execute
*-----End of Code ----

I can update/insert records with numeric or character data, but not with dates.
I get the message "Microsoft OLEDB Provider for Visual Foxpro: Data type mismatch"
I believe the date format I'm using is incorrect ("MM/DD/YYYY"). Can anyone shed any light on this? Thanks for any help
(Yes, its not VB it's Lotus script, but hopefully its a data format problem and not a dev environment problem)
Wayne
 

Wayne,

I agree that the problem is not related to the Lotus Script, and you are right to post it in a VFP-related forum. However, there is a separate forum -- forum1252 -- specifically for data-related issues, so you might get a faster response there.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Thanks Mike,
I'll repost in the other forum.

Wayne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top