Click here to Skip to main content
14,869,731 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I created a WinForms application in C# with an SQL Server database.

When I execute an insert query no errors are returned, but no data is inserted either.

So please help me.
Updated 4-Jul-10 17:00pm
Abhinav S 4-Jul-10 7:18am
Maybe if you place some of your code here, someone might be able to help you.
Sandeep Mewara 4-Jul-10 9:51am
Share your code, that would help in analysing the issue.
Siva Kishore G 5-Jul-10 0:25am
If you paste your code then we can analyse it & try to solve your problem. Fixed stupid txtspk!
Christian Graus 5-Jul-10 1:47am
If you think we can answer based on this, you plainly know nothing about programming and should read a book or take a course. How can anyone answer a question that doesn't tell us what you did ?

1 solution

I believe it because you forget to use the ‘ExecuteNonQuery()’ line.
Perhaps this helps you:
Obs.: My values come from text box this is why they are so weird whit that quotation marks.

SqlConnection conexao = ConnectionFactory.NovaConexao();
SqlCommand comando = new SqlCommand("Insert into MyTable values('"+ txtValue1.Text +"', '"+ txtValue2.Text +"'", conexao);


Hope this help.

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