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:
00694010
Views:
30
>
>Try the following code..
>
>
>OleConnection nConn = new OleConnection("Your Connection String");
>
>OleCommand OleCMD = new OleCommand("NewId", nConn);
>OleCMD.CommandType = CommandType.StoredProcedure;
>
>SqlParameter myParm = OleCMD.Parameters.Add("@TableId", SqlDbType.NVarChar, 15);
>myParm.Value = "User";
>
>nConn.Open();
>
>object oReturnValue = OleCMD.ExecuteScalar();
>
>Console.WriteLine(oReturnValue.ToString())
>
>
That also doesn't work. Actually, the code you provided assumes I'm connecting to a SQL server database. I'm using OLE-DB to connect to a Visual FoxPro database. I adjusted the code to reference the OleDb class instead, but it fails with a "Input string was not in a correct format." error when ExecuteScaler() fires.
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform