c# - SqlDataAdapter does not delete the rows from the table -


i have set of ids in c# datatable. @ same time, have table containing ids , other data too. requirement delete records contains ids specified in data table ( if there tuples ids).

i'm using sqldataadapter that.

sqlcommand command = new sqlcommand(text, con);   command.updatedrowsource = updaterowsource.none; preparecommand(command, con, null, type, text, commandparas);  sqldataadapter adpt = new sqldataadapter(); adpt.deletecommand = command;  adpt.updatebatchsize = 2;  adpt.update(datatable);  connection.close(); 

here mean by,

- "text" name of stored procedure containing delete command. argument given stored procedure id ( picked list of ids contained in data table)   - "commandparas" argument passed stored procedure.  - "datatable" contains ids used delete rows  sql table. contains 1 column several rows. 

but not result in specified rows being removed table.

edit

i have given stored procedure below

create procedure somename(@id int) begin      delete sampletable      id=@id end 

what have given below code create data table

   datatable dt=new datatable("abc");    dt.clear();    dt.columns.add(empid,typeof(int));     foreach(someclass t somelist)          dt.rows.add(t.idno); 

have made mistake ?

i see call preparecommand, , set adapter adapter's deletecmmand, run command?


Popular posts from this blog