删除C#的按钮编码 [英] Delete button coding for C#

查看:100
本文介绍了删除C#的按钮编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我已经创建了表单,在其中添加了四个按钮,即添加",编辑",删除",阻止".如果单击添加按钮,则会显示添加表单.如果单击编辑"按钮,则会为我显示一个空表单它应该打开所有详细信息的表单.编辑,删除和阻止的过程相同...

问候
Balamurugan

Hi,
I have created the form, in that added four buttons namely Add,Edit,Delete,Block.If i''m clicking the add button the add form is diplayed.If i''m clicking Edit button the empty form is displayed for me it should open the form with all details.The same process for edit,delete and block...

Regards
Balamurugan

推荐答案

您可以编写的所有内容都可以编辑,删除,但cmd行中唯一的变化

在页面加载中,您必须从表中提取数据.
you can write everything is same to edit,delete but the only changes in cmd line

In page load you have to reterive the data''s from table.
SqlCommand cmd=new SqlCommand("select * from UserCreation");


为了进行编辑,您需要使用cmd as
更新数据库.


and for edit something you need to update your database with cmd as

SqlCommand cmd=new SqlCommand("update UserCreation set columnname2= '"textbox2.Text'",columnname3='"textbox3.Text'" where columnname1= '"textbox1.Text'" ");


同样,要删除某些内容,您还需要使用cmd as
从数据库中删除.


similarly for delete something you also need to delete from database with cmd as

SqlCommand cmd=new SqlCommand("delete from UserCreation where columnname1= '"textbox1.Text'" ");


我认为这是一个简单的模型,您可能会有所想法.


This is simple model I think you may get some ideas.


单击编辑"按钮时,它的显示形式为空,因为页面已回发.因此,单击编辑"按钮时,您应将数据绑定到控件.
On click of Edit button its displyainng empthy form because page is post back .so on click of Edit button u should bind your data with controls .


这篇关于删除C#的按钮编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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