Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I m making a program in .Net 3.5, and i want to use delete command in Ado.NET, (backend on sql server 2005).
i dont know how exactly to use this command.
Pls can someone help me with coding?

Example.. insert command

private void button4_Click(object sender, EventArgs e)
       {
           cm = new SqlCommandBuilder(da);
           MessageBox.Show(cm.GetInsertCommand().ToString());
           da.Update(ds.Tables[0]);
           MessageBox.Show("updated");

       }



delete command....


{ tell me }
Posted
Updated 31-Oct-17 7:19am
v3

Here are the details that you need to know:
SqlCommand Class[^]
As in the sample in link, just change the SQL string the way you want to. Set it in the command. May be it is Insert, Update or a Delete. Execute it.

Read this for learning all basics with samples here:
ADO.NET[^]

UPDATE:
After providing all the details/links, if you are still waiting for an answer, might be you are not putting your question properly.
Just assuming few things and based on what can fit in your question, look at this, if it helps:
Delete Data using CommandBuilder[^]
 
Share this answer
 
v2
Common.cmdbuilder = new System.Data.SqlClient.SqlCommandBuilder(Common.StockPurchase_Part);
                           Common.StockPurchase_Part.DeleteCommand = Common.cmdbuilder.GetDeleteCommand();
                           Common.StockPurchasePartDataset.Tables[0].Rows[0].Delete();
                           Common.StockPurchase_Part.Update(Common.StockPurchasePartDataset.Tables[0]);



Mark the dataset and call Update
 
Share this answer
 
Comments
CHill60 31-Oct-17 19:47pm    
Avoid trying to answer questions that are over 7years old! It looks like rep point farming. Stick to new questions where the OP might still need help

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