Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Insert record and return value
Message
De
28/09/2004 14:05:59
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, États-Unis
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Titre:
Insert record and return value
Divers
Thread ID:
00946845
Message ID:
00946845
Vues:
69
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform