Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i need to have multiple conditions in single update statement using where condition?

C#
sql = "Update [Sheet1$] set FinalStatus='Success' where Name='mahesh'";


update [Sheet1$] set FinalStatus='Success' where Add='CMB', FinalStatus='Success', Contact='1234';
Posted
Comments
King Fisher 21-Nov-14 6:09am    
update [Sheet1$] set FinalStatus='Success' where Add='CMB' and FinalStatus='Success' and Contact='1234';

1 solution

use "and"
SQL
update [Sheet1$] set FinalStatus='Success' where Add='CMB' and FinalStatus='Success' and Contact='1234';
 
Share this answer
 
Comments
Hemas Ilearn 21-Nov-14 6:28am    
how do i compare with string?

string name = "sgfsdg";
sql = "Update [Sheet1$] set FinalStatus='f***' where Name="name" and Team='Group 2'";
DamithSL 21-Nov-14 6:29am    
sql = "Update [Sheet1$] set FinalStatus='f***' where Name='"+ name +"' and Team='Group 2'";
ZurdoDev 21-Nov-14 7:52am    
+5
DamithSL 21-Nov-14 8:45am    
Thank you, RynDev
Maciej Los 21-Nov-14 11:26am    
+5

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