Durga Velusamy

Durga Velusamy

  • NA
  • 318
  • 108.3k

how to delete data from database in webservice

Jul 1 2015 7:02 AM
any one give simple example code for this 
 
please tell me what changes i have to do to delete the data from table 

[WebMethod(EnableSession=true)]

public List<Emptab> delete(string ls_pkvalue)

{

List<Emptab> tDataList = new List<Emptab>();

Emptab tdata;

var a = new Array();

a[0] = empno.string;

a[1] = gender;

a[2] = eaddress;

a[3] = street;

try

{

tdata = new Emptab();

string ls_query = "";

ls_query = @"delete  ('" + a[0] + "','" + a[1] + "','" + a[2] + "')from emptab ";

odcon = new OdbcConnection(con);

odcon.Open();

comm = new OdbcCommand(ls_query, odcon);

comm.ExecuteNonQuery();

tdata.dsexecstatus = "SUCCESS";

tdata.dsmsg = "Updated Succesfully";

tDataList.Add(tdata);

}

catch (Exception)

{

throw;

}

odcon.Close();

return tDataList;

}

}

}

 

Answers (2)