I dont know where I post this question.,anyway i run sql statement in C#,but once i run my applcaiton it gives me error message .It says
incorrect synatx near keywork 'AND'
this is my sql statement.


string str1 = "UPDATE dbo.Retailer SET SalesExecutiveCode='" + this.comboBox1.Text + "'" + " AND TerritoryCode='" + this.comboBox2.Text + "'" +
" where RetailerCode='" + list_value.ToString() + "'";

.Once I debug the application and get value for str1.and below i mention what is value i got for str1

"UPDATE dbo.Retailer SET SalesExeutiveCode='SE0037' AND TerritoryCode='TM04' where RetailerCode='00016658'"

Pls help me.

Thanks

Recommended Answers

All 2 Replies

Really stupid question.:@
Anyway I found correct syantax

UPDATE dbo.Retailer SET SalesExeutiveCode='SE0037' ,TerritoryCode='TM04' where RetailerCode='00016658'"

Thanks

yep the problem was the "and" :)

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.