string sqlStr = "select * fromstudentinfo where num = '" + textBox2.Text + "'";这里你错了 应该是string sqlStr = "select * from studentinfo where num = '" + textBox2.Text + "'";要有空格隔开啊,其他的还没有仔细看,你试试 或者你再错 就复制那个错误信息出来看看