我想只删除帐户号,但删除完整行的查询。请提前帮助我 [英] i want to delete just account no but the query deleting complete row. help me with this, thanx in advance

查看:57
本文介绍了我想只删除帐户号,但删除完整行的查询。请提前帮助我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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);

推荐答案

尝试这个



TRY THIS

query = "UPDATE Customer 
SET Account_No=NULL
WHERE Account_No=@Account_No";


您好


您需要将Account_No更新为值,例如Null或其他值存在价值。



如果您需要更多帮助,请与您需要的当前值和最终值共享您的表格结构。
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.


这篇关于我想只删除帐户号,但删除完整行的查询。请提前帮助我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆