保存按钮的代码 [英] code for save button
本文介绍了保存按钮的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在做一个基于Web的GUI.其前端是ASP.NET.屏幕上有许多控件,例如下拉列表,文本框等.当在下拉列表中选择垂直参数时,其当前设置应保存在数据库中.需要C#代码作为保存按钮.请指导我..m是C#的新手
关于
Hi,
I am doing a web based GUI.Whose front end is ASP.NET.The screen has many controls such as dropdown,textbox etc.When a perticular parameter in the dropdown is selected its current settings should be saved in the data base.So i need C# code for the save button.Please guide me..m new to C#
Regards
推荐答案
SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=Your Database Name;Integrated Security=True");
con.Open();
SqlCommand command= new SqlCommand();
command.Connection = con;
command.CommandType = CommandType.Text;
command.CommandText = "your query here"
try
{
command.ExecuteNonQuery();
con.Close();
}
catch (Exception e)
{
}
请参见保存按钮的代码 [^ ].您所有此类问题都是无用的.
另请参见:更新按钮的C#代码 [ ^ ].
—SA
See code for save button[^]. All your questions of this sort are useless.
See also: C# code for the update button[^].
—SA
这篇关于保存按钮的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文