Click here to Skip to main content
14,970,019 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am inserting Data into sql server db and use ADODB Command to execute the sql query.

C#
"command.Execute(out rowsAffected, ref missing, (int)ExecuteOptionEnum.adExecuteNoRecords)"

and add the the affected rows into recordset using this cmd :
VB
"SELECT @@IDENTITY"
"recordSet.Open(command, missing, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly)"

the command is executed without error even the data is added to recordset but the data is not actually inserted(commited) to database.

no issue with connection string.

please suggest for this
Posted
Updated 25-Feb-13 8:06am
v3
Comments
Tharaka MTR 25-Feb-13 10:24am
   
please provide the complete code sample
ali khanna 27-Feb-13 9:40am
   
the code is like
<pre lang="c#">
object rowsAffected = null
object missing = Type.Missing;
command.ActiveConnection = "";
command.CommandText = "Insert into table query**";
command.CommandType = CommandTypeEnum.adCmdText;
command.Execute(out rowsAffected, ref missing, (int)ExecuteOptionEnum.adExecuteNoRecords)
</pre>
Abhinav S 25-Feb-13 10:38am
   
Your update query is working?
ali khanna 27-Feb-13 9:26am
   
yes the insert query is executed well in database .. when go through code runs without error but no updation in Database

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900