Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inserting a new record via OleDbCommand
Message
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00693070
Message ID:
00694039
Views:
27
>
>This assumes that the first column is the ID field. I'll have to play with getting return values from a VFP store procedure, but for now this will work. And, for some reason, it doesn't want to cast to an integer: int iRet = oleCmd.ExecuteScalar(); I'll have to play around with the syntax some more (even though it is shown this way in the docs).


What a confused post. I said one thing, thought another. When NewID('table') is the command being sent, everything works OK. There is only one value being returned, so life is good. I'll use this to prefetch my ID PK. If I use ExecuteScalar with my normal command string, it will assume the PK field is the first one, which I'm not thrilled about. So I think I'll just prefetch the ID.

I ended up using this code to translate the int:
int iID = int.Parse(oleCmd.ExecuteScalar().ToString(), System.Globalization.NumberStyles.Any); 
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Reply
Map
View

Click here to load this message in the networking platform