I want to write a IFEXISTS condition and update the record from the code behind I don't know whether its possible or not...
if its possible then someone please tell me the syntax for that..
How to update the record..
I want to write something like this.. but what is correct?
public void UpdateModalitiesId(int? CaseId, int ModalitiesId)
{
string query = "if exists (select count(*) from ImageModality where ImageModality.Id='"+ ModalitiesId +"')
UPDATE ImageGroup set ImageModalityId='" + ModalitiesId + "' where BaseCaseId='" + CaseId +"' ;
//string query = "UPDATE ImageGroup set ImageModalityId='" + ModalitiesId + "' where BaseCaseId='" + CaseId + "'";
SqlHelper.ExecuteNonQuery(strConnectionString, CommandType.Text, query);
}