2.信息显示/查询模块
在界面中添加一个RadioButtonList按钮,一个textBox文本控件,两个命令button,三个连接按钮,一个GridView。对于RadioButton,Id改为MySelect,Item变为货品代码和生产商RepeatDirection的值为Horizontal,button1改为Search,和ShowAll.linkButton的Id改为InsRecord和UpdateRecord,DelRecord.text属性改为添加货品,修改货品,删除货品。本文来自辣.文'论.文·网原文请找腾讯3249.114
代码如下:
using System.Data.SqlClient;
protected void Page_Load(object sender, EventArgs e)
{ this.Title = "货品信息管理";
string ConnSql = "Data Source=.;Initial Catalog=货品信息管理;Integrated Security=True";
//声明Conn为一个SQL Server连接对象
SqlConnection Conn = new SqlConnection(ConnSql);
Conn.Open(); //打开连接
SqlDataAdapter da = new SqlDataAdapter(); //创建DataAdapter对象
string SelectSql = "select * from tb_Goods";
da.SelectCommand = new SqlCommand(SelectSql, Conn);
DataSet ds = new DataSet();
da.Fill(ds);
Conn.Close();
GridView1.DataSource = ds;
GridView1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
}
protected void InsRecord_Click(object sender, EventArgs e)
{
Response.Redirect("add.aspx");
}
protected void UpdateRecord_Click(object sender, EventArgs e)
{
Response.Redirect("update.aspx");
}
protected void DelRecord_Click(object sender, EventArgs e)
{
Response.Redirect("del.aspx");
}
protected void Search_Click(object sender, EventArgs e)
{
string ConnSql = "Data Source=.;Initial Catalog=货品信息管理;Integrated Security=True";
//声明Conn为一个SQL Server连接对象
SqlConnection Conn = new SqlConnection(ConnSql);
Conn.Open(); //打开连接 本文来自辣.文'论.文·网原文请找腾讯324.9114
SqlDataAdapter da = new SqlDataAdapter(); //创建DataAdapter对象
string SelectSql = "";
switch (MySelect.SelectedIndex)
{
case 0:
SelectSql = "select * from tb_Goods where 货品代码 like '%" + QueryText.Text + "%'";
break;
case 1:
SelectSql = "select * from tb_Goods where
论文网http://www.751com.cn/ 生产商 like '%" + QueryText.Text + "%'";
break;
}
da.SelectCommand = new SqlCommand(SelectSql, Conn);
DataSet ds = new DataSet();
da.Fill(ds);
Conn.Close();
GridView1.DataSource = ds;
GridView1.DataBind();
}
protected void Unnamed1_Click(object sender, EventArgs e)
{
}
3 信息添加模块
向页面中添加一个HTML表,7个textBox控件,和2个botton,把他的ID改为Submit,BackHome.TEXT改为提交和返回。代码 如下
上一页 [1] [2] [3] [4] 下一页
asp.net+sqlserver货品信息管理系统源代码+实验报告+运行流程图 第2页下载如图片无法显示或论文不完整,请联系qq752018766