首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

哪位大神能帮小弟我看下代码错哪了吗

2013-12-28 
哪位大神能帮我看下代码哪里错了吗?private void button3_Click(object sender, EventArgs e){serach()}p

哪位大神能帮我看下代码哪里错了吗?
private void button3_Click(object sender, EventArgs e)
        {
            serach();
        }
        public void serach()
        {
            // sqlInit();
            // Database conn = new Database();
            connection = new OleDbConnection(ConnStr);
            connection.Open();
            string s = textBoxSelectName.Text;
            string selectStudentInfo = "SELECT  * FROM [Student]  WHERE [姓名]='"+ textBoxSelectName +"'";
            OleDbDataAdapter Adap = new OleDbDataAdapter(selectStudentInfo, connection);
            DataSet data = new DataSet();
            Adap.Fill(data,"Student");                         
            DataSet ds = data;
            dataGridViewSelectStudentManage.DataSource = ds.Tables["Student"];
            connection.Close();

        }
数据库的链接,添加都实现了,就是这个查询实现不了,输入名字的话,不出来结果,只出来一行空白。听说CSDN上的大神很多,特来求教!
[解决办法]
-_-

string selectStudentInfo = "SELECT  * FROM [Student]  WHERE [姓名]='"+ textBoxSelectName +"'";

textBoxSelectName明显是textbox对象啊,好心调试一下啊
[解决办法]
目测没有问题,你拿断点跟一下,把sql语句在数据库中运行一下看有没有结果。
[解决办法]
string selectStudentInfo = "SELECT  * FROM [Student]  WHERE [姓名]='"+ s +"'";

热点排行