sqlconnection = new SqlCeConnection(ConnectionString);
sqlcommand = new SqlCeCommand();
sqlconnection.Open();
sqlcommand.Connection = sqlconnection;
sqlcommand.CommandText = (@"UPDATE ItemStock_Info SET Quantity =@qun WHERE [Item_Number]='"+ textBox1.Text +"'");
sqlcommand.Parameters.Add("@qun", qun);

Recommended Answers

All 4 Replies

You're getting better. But when I work SQL problems like this I take the command and try it from my SQL command line. That way I can see if the syntax is right.

Yes, M. Before you write an app to interact with a SQL server you would have learned to use a SQL command line to practice with.

Maybe you skipped an important tutorial or lesson?

?? WHERE [Item_Number]='"+ textBox1.Text +"'"
Do it with parameter as you did about 'qun'.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.