毕业论文

打赏
当前位置: 毕业论文 > 计算机论文 >

ASP.NET客户信息管理系统的开发(17)

时间:2016-11-27 21:00来源:毕业论文
sqlConnect(); string strsql = select shengshi as 省市名称,xianshi as 县市名称, quxian as 区县名称,custormid as 客户编号,kehuname as 客户名称,kehudizhi as 地址,youbian as 邮编,b


                sqlConnect();
                string strsql = "select shengshi as 省市名称,xianshi as 县市名称, quxian as 区县名称,custormid as 客户编号,kehuname as 客户名称,kehudizhi as 地址,youbian as 邮编,bumen as 部门,officetp as 办公室电话,chuanzhen as 传真,kehu_mail as 客户邮箱,website as 网址,kehutype as 客户类型,kehudata as 创建日期 from kehu where custormid between " + textBox1.Text + "and " + textBox2.Text + "";
                SqlCommand cmd = new SqlCommand(strsql, conn);
                if (cmd.ExecuteScalar() == null)
                {
                    MessageBox.Show("查无资料");
                    return;
                }
                else
                {
                    SqlDataAdapter ad = new SqlDataAdapter(cmd);
                    DataSet sd = new DataSet();
                    ad.Fill(sd);
                    GridView1.DataSource = sd.Tables[0];
                    button2.Enabled = true;
                }
                
            }
单击“导出”按键,将当前显示的客户信息,以excel表格形式进行导出,随后就可以进行打印等操作 (如图3.17所示)
 
图 3.17导出结果
3.4.3查看全部:直接显示全部的客户信息与对应的联系人信息 (如图3.18所示)
 
图 3.18查看全部
查看全部功能的实现十分简单,直接创建一个视图,将客户信息表和联系人信息表联系在一起,然后通过代码,将重复的属性去掉,最后将视图装载进Grid View 控件中就好了。
装载的代码如下:
sqlConnect();
            string strsql = "select * from View_1";
            SqlCommand cmd = new SqlCommand(strsql, conn);
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet ds = new DataSet();
            da.Fill(ds);
            dataGridView1.DataSource = ds.Tables[0];
            sqlClose();
3.4.9    用户修改密码 ASP.NET客户信息管理系统的开发(17):http://www.youerw.com/jisuanji/lunwen_460.html
------分隔线----------------------------
推荐内容