M
Mark Vroom
I need some help on inserting records from vb.net into Visual FoxPro. In
VFP8 we (finally) got primary key type fields. That solved some issues with
the oledb driver, the driver is now able to determine which field the
primary key field is. Unfortunately I still cannot find a property like (for
example) @@identify like in sql server to determine the primary key value of
a new inserted record.
Off course I can get the complete dataset again in vb.net, but when
inserting a few records it's not good for performance and bandwith reasons
to retrieve the complete dataset again. When connecting from vb.net to a sql
server, the sql server is able to return the values of the inserted records
by adding ;select @@identity to the InsertCommand. Does anyone know if this
is possible now in some way while inserting into vfp?
The older solution to this problem was to make a separate table in vfp in
which all primary key values of all tables in the database were stored. Just
ask this table by a vfp stored procedure for a new primary key, add the
value to the vb.net dataset and then execute the insert function to vfp. As
a matter of fact, by this way the primary key field is 'dictated' by vb.net.
FoxPro 9 has made some progression by the new primary key field type, but we
can't supply a value in this field type from vb.net anymore. So the old
solution does not work anymore when using the new field type. (Some you win,
some you loose ;-)
Greets,
Mark Vroom.
VFP8 we (finally) got primary key type fields. That solved some issues with
the oledb driver, the driver is now able to determine which field the
primary key field is. Unfortunately I still cannot find a property like (for
example) @@identify like in sql server to determine the primary key value of
a new inserted record.
Off course I can get the complete dataset again in vb.net, but when
inserting a few records it's not good for performance and bandwith reasons
to retrieve the complete dataset again. When connecting from vb.net to a sql
server, the sql server is able to return the values of the inserted records
by adding ;select @@identity to the InsertCommand. Does anyone know if this
is possible now in some way while inserting into vfp?
The older solution to this problem was to make a separate table in vfp in
which all primary key values of all tables in the database were stored. Just
ask this table by a vfp stored procedure for a new primary key, add the
value to the vb.net dataset and then execute the insert function to vfp. As
a matter of fact, by this way the primary key field is 'dictated' by vb.net.
FoxPro 9 has made some progression by the new primary key field type, but we
can't supply a value in this field type from vb.net anymore. So the old
solution does not work anymore when using the new field type. (Some you win,
some you loose ;-)
Greets,
Mark Vroom.