注册 登录
编程论坛 ASP技术论坛

窗体里面的查看功能没有完善求高手来看下那做了!!!!

MHxn 发布于 2013-01-24 00:47, 336 次点击
[local]1[/local] 求助啊  ,这是什么问题啊  我的这个问题是窗体问题!   我的问题就是为什么read没有作用
 if (this.textBox1.Text.Equals(string.Empty))
            {
                MessageBox.Show("请输入花卉名称","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
            }
            try
            {
                string sql1 = "select name,anothername,propery,price,production from FlowerManagerSys where name like '" + this.textBox1.Text + "%'";
                DataTable dat = db.getSet(sql1).Tables[0];
                dataGridView1.DataSource = dat;
                SqlDataReader data = db.get(sql1);
                if (!dat.Read())
                {
                    MessageBox.Show("此花卉不存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("程序错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
0 回复
1