Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C#
 query = "DELETE FROM Customer WHERE Account_No=@Account_No";
                                        SqlCommand cmd = new SqlCommand(query, cn);
                                        cmd.Parameters.AddWithValue("@Account_No", txtaccount1.Text + "-" + txtaccount2.Text);
                                         MessageBox.Show("Record Deleted Successfully", "Success Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
Posted 3-Jan-13 6:16am
CHill60 at 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
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

query = "UPDATE Customer 
SET Account_No=NULL
WHERE Account_No=@Account_No";
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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.
Reza Alipour Fard at 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.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Zoltán Zörgő 300
1 CHill60 185
2 Peter Leow 170
3 /\jmot 160
4 Pikoh 125
0 Sergey Alexandrovich Kryukov 9,383
1 OriginalGriff 6,881
2 Peter Leow 4,607
3 Zoltán Zörgő 4,284
4 CHill60 2,892

Advertise | Privacy | Mobile
Web04 | 2.8.150129.1 | Last Updated 3 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100