Click here to Skip to main content
15,914,642 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
query = "DELETE FROM Customer WHERE Account_No=@Account_No";

                                       SqlCommand cmd = new SqlCommand(query, cn);
                                       cmd.Parameters.AddWithValue("@Account_No", txtaccount1.Text + "-" + txtaccount2.Text);
                                       cn.Open();
                                       cmd.ExecuteNonQuery();
                                       cn.Close();
                                        MessageBox.Show("Record Deleted Successfully", "Success Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
Posted
Comments
CHill60 3-Jan-13 11:25am    
Are you saying that you want to set the Customer.Account_No to blank? If so then you need to use an UPDATE clause in your SQL not DELETE
[no name] 3-Jan-13 12:01pm    
Share your table structure here.

TRY THIS

SQL
query = "UPDATE Customer 
SET Account_No=NULL
WHERE Account_No=@Account_No";
 
Share this answer
 
v2
Hi
You need Update Account_No to a value for example Null or other not exist value.

If you need more help, please share your table structure with current values and final values you need.
 
Share this answer
 
Comments
[no name] 3-Jan-13 13:26pm    
If you need any clarification then add that in the comments not in the solution.
Reza Alipour Fard 3-Jan-13 13:34pm    
I present a solution and for more detail I said if need to more help clarification.
Why you get Down voted???
I think you have wrong in this action.
However, Thank you for your attention.
[no name] 3-Jan-13 13:41pm    
The answer that you have given is not correct. There is lack of data in the question so u should have asked for the appropriate knowledge.
Thanks

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