基本信息
源码名称:ListView显示数据库数据并实现查询、修改、更新
源码大小:0.61M
文件格式:.rar
开发语言:C#
更新时间:2018-11-08
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍

ListView显示数据库SQL数据并实现查询、修改、更新,list中显示图片等功能


private void BtnModfy_Click(object sender, EventArgs e)
        {
            SqlConnection connection;
            string strUpdate = "Update tb_02 set Approp='"   txtPrice.Text.Trim()   "' where ID='"   txtID.Text.Trim()   "'";
            using (connection = new SqlConnection("server=.;pwd=test;user=sa;database=db_02"))
            {
                connection.Open();
                SqlCommand command = new SqlCommand(strUpdate, connection);
                if (command.ExecuteNonQuery() > 0)
                {
                    MessageBox.Show(string.Format("编码为:{0}的产品价格已经更新为{1}", txtID.Text.Trim(), txtPrice.Text.Trim()));
                }
             }
            ListViewDisplayDate(listView1);
        }

        //查询按钮代码
        private void BtnSearch_Click(object sender, EventArgs e)
        {
            ListViewDisplayDate(listView1);
        }

        //删除按钮代码
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            SqlConnection connection;
            string strUpdate = "Delete from  tb_02  where ID='"   txtID.Text.Trim()   "'";
            using (connection = new SqlConnection("server=.;pwd=test;user=sa;database=db_02"))
            {
                connection.Open();
                SqlCommand command = new SqlCommand(strUpdate, connection);
                if (command.ExecuteNonQuery() > 0)
                {
                    MessageBox.Show(string.Format("编码为:{0}的产品价格已删除", txtID.Text.Trim()));
                }
            }
            ListViewDisplayDate(listView1);
        }