Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Insert record and return value
Message
From
28/09/2004 14:05:59
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
 
 
To
All
General information
Forum:
ASP.NET
Category:
ADO.NET
Title:
Insert record and return value
Miscellaneous
Thread ID:
00946845
Message ID:
00946845
Views:
70
I have a routine that inserts a record into a table. But now I also want to return a value from a field in the table after I insert the record.

For example, I have a VFP table with a auto-inc int field, called "mykey", that I use as the primary key for the table. When I insert a record into this table, how can I return the value of the "mykey" field which is auto-generated by the table?

Here is my code:
string lc_Conn = @"provider=VFPOLEDB.1 ;data source='C:\\data\\'";
string SelectCmd = "INSERT INTO mytable (mycompany, mypo) " + 
	"VALUES ('" + mycompvar + "', '" + mypovar +  "')";
DataSet ds = new DataSet();
OleDbDataAdapter DataAdapter = new OleDbDataAdapter(SelectCmd, lc_Conn);
DataAdapter.Fill(ds, "mytable");
//At this point, how can I get the value of the field "mykey"?
Thanks,

Jerry
Next
Reply
Map
View

Click here to load this message in the networking platform