当前位置:编程学习 > C#/ASP.NET >>

查询acess数据库遇到的问题

下面是查询的代码,点击查询却没有任何反应,我是新手,请大家帮忙看看,谢谢!
private void button3_Click(object sender, EventArgs e)
        {
            if (chaxuntiaojian.Text == "" && chaxunzhi.Text == "")
        
         MessageBox.Show("请填写查询条件!","警告信息",MessageBoxButtons.OK ,MessageBoxIcon.Error);
                chaxuntiaojian.Focus();
            try
            {
                string strsql="";
                switch (chaxuntiaojian.Text.Trim())
                {
                    case "负责人":
                        strsql = "select shijian,renwulaiyuan,renwuneirong,fuzeren,yaoqiushijian,jindugenzong,wanchengqingkuang,wanchengshijian,beizhu from tb_Product where fuzeren='" + chaxunzhi.Text.Trim() + "'";
                        break;
                    case "已完成":
                        strsql = "select shijian,renwulaiyuan,renwuneirong,fuzeren,yaoqiushijian,jindugenzong,wanchengqingkuang,wanchengshijian,beizhu from tb_Product where wanchengqingkuang='是'";
                        break;
                    case "未完成":
                        strsql = "select shijian,renwulaiyuan,renwuneirong,fuzeren,yaoqiushijian,jindugenzong,wanchengqingkuang,wanchengshijian,beizhu from tb_Product where wanchengqingkuang='否'";
                        break;
                    case "指定结束":
                        strsql = "select shijian,renwulaiyuan,renwuneirong,fuzeren,yaoqiushijian,jindugenzong,wanchengqingkuang,wanchengshijian,beizhu from tb_Product where wanchengqingkuang='指定结束'";
                        break;
                    case "时间区间":
                        strsql = "select shijian,renwulaiyuan,renwuneirong,fuzeren,yaoqiushijian,jindugenzong,wanchengqingkuang,wanchengshijian,beizhu from tb_Product where wanchengshijian between='" + qishishijian.Text.Trim() + " and " + jieshushijian.Text.Trim() + "'";
                        break;
                    
                }
                
            }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
            
        } --------------------编程问答-------------------- oledbconnection/oledbcommand/这些核心数据库操作对象都没有,怎么查询呢?
refer:http://blog.csdn.net/gisfarmer/article/details/3648761 --------------------编程问答-------------------- 汗!就写了个查询语句。。。 --------------------编程问答-------------------- 查询条件的输入框里 得输入  "负责人,已完成,未完成,指定结束,时间区间" 这几个词中的一个才行...
--------------------编程问答-------------------- 看看ADO.NET。。
sqlconnection
sqlCommand
sqlDataAdapter
datset
补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,