Question

Referring post : C# - ExecuteNonQuery() isn't working with SQL Server CE

I have the same problem with an attached Access Database to my Project and indeed i try to Insert records but all in vain, it tells me that it's inserted but no records found..

Well the above post discussed the problem and its cause but i want to know more about the solution... How Can i Solve this problem???

Best Regards,

Baher.

Was it helpful?

Solution

I think I found out the Solution , after searching for sometime i did the following changes:

1- In the Solution Explorer I changed the property of my database which is Copy to Output Directory : always To Copy to output Directory : Do not Copy

2- In the Serve Explorer i right clicked my database and modified the Connection to it to the database which exists in my bin folder.

That's it...

Hope that it helps

OTHER TIPS

Are you using transactions? If yes, make sure that you are committing it or that you're not accidentally rolling back

sir, i think the connection is already open since the query did not throw any exception, w

sir what does ur query look like? String representation, since if you have a WHERE clause, and the field is missing,or if ur updating, a WHERE claause would not throw an exception and would tell you that everything is inserted but probably not, since it has accessed the databse and looked for the table, but didnt find any variables, it just passed....

  1. check that your connection is open when you execute in c#
  2. check that you have no uncommitted transaction in sql
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top