Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inserting into a .dbf GENERAL field from C#
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01392510
Message ID:
01392543
Views:
53
>Hi All;
>
>We have a VFP application that adds records to a .dbf free table and updates an OLE General field with a pointer to a Word Document. The VFP code that works is listed below.
>
> USE FILE1
> APPEND blank
> REPLACE z_date with date()
> REPLACE z_id with recid
> REPLACE z_type with 'AFW2_2'
> APPEND GENERAL z_data FROM ”c:\test\myresume.doc” CLASS MICROSOFTWORD
>
>We are trying to replicate this in C#. We can do everything but insert the link into the General field. What we have below is as close as we can come using the VFP ODBC connector to accomplish the same results as the VFP code above.
>
> DBCommand = DBConnection.CreateCommand();
> DBCommand.CommandText = "insert into FILE1 (Z_DATE,Z_ID,Z_DATA)" +
> " values (Date()," +
> "'" + Sage_OrgID + "'," +
> "'')";
> DBCommand.ExecuteNonQuery();
> DBCommand.Dispose();
>
>Is there some special trick to getting data into these General Fields? I remember have to fool around with it to get the VFP code working originally . Any assistance would be greatly appreciated.

INSERT command cannot be used to update/add data to VFP general field. As in your VFP code above, you need to use > APPEND GENERAL > statement instead.

Other than that, what do you mean exactly, "VFP ODBC connector"? If ODBC, then I am not sure whether it supports general fields.
I would recommend to use VFP OLEDB instead.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform