Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 4729

insert query with where clause in windows form C#

$
0
0

Hi everyone!

I am using the following code to insert data into a table called 'callreference' 

           

cmd = new SqlCommand("insert into callreference (cat1,pd1,q1,vendor1,pi1,idate1) values ('" + comboBox9.Text + "','" + textBox3.Text + "','" + textBox5.Text + "','" + comboBox1.Text +"','" + textBox7.Text + "','" + dateTimePicker2.Text + "' where callref = '"+textBox1.Text+"')", con);

cmd.ExecuteNonQuery();

The attribute callref used with where clause is already present in the table.            


and I am getting the exception :- Incorrect syntax near the keyword 'where'. 

Why is this so?

kindly help! thanks!


Viewing all articles
Browse latest Browse all 4729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>