1 Star 0 Fork 0

ymbao1984/YMB_win.Staff_management

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
departmentcodelist.aspx.cs 1.80 KB
一键复制 编辑 原始数据 按行查看 历史
ymbao1984 提交于 2016-03-10 16:23 . 完成了
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;
public partial class codelist : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
//删除
protected void gv_department_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
string sqlstr = "delete from t_department where idepartment_ID='" + gv_department.DataKeys[e.RowIndex].Value.ToString() + "'";
string str = ConfigurationManager.ConnectionStrings["DevMgmntConnectionString"].ConnectionString.ToString();
SqlConnection cn33 = new SqlConnection(str);
cn33.Open();
SqlCommand sqlcom = new SqlCommand(sqlstr, cn33);
sqlcom.ExecuteNonQuery();
cn33.Close();
gv_department.DataBind();
}
protected void bt_departmentAdd_Click(object sender, EventArgs e)
{
TextBox t1 = tx_departmentID;
TextBox t2 = tx_departmentName;
try
{
string str = ConfigurationManager.ConnectionStrings["DevMgmntConnectionString"].ConnectionString.ToString();
SqlConnection cn33 = new SqlConnection(str);
cn33.Open();
str = "insert INTO t_department (idepartment_ID,sdepartmentName) values ('" + t1.Text.Trim() + "','" + t2.Text.Trim() + "')";
Console.WriteLine("btn_departmentAdd:{0}", str);
SqlCommand cmd2 = new SqlCommand(str, cn33);
cmd2.ExecuteNonQuery();
cn33.Close();
}
catch (Exception ex)
{
Console.WriteLine("传递过来的异常值为:{0}", ex);
}
gv_department.DataBind();
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ymb/YMB_win.Staff_management.git
git@gitee.com:ymb/YMB_win.Staff_management.git
ymb
YMB_win.Staff_management
YMB_win.Staff_management
master

搜索帮助