想用c#语言写一段代码,实现查询功能,具体信息显示在控件datagrid上,但老提示错误,求高手帮忙,谢谢

2025-04-30 18:24:06
推荐回答(1个)
回答1:

string sqlStr = "select * fromstudentinfo where num = '" + textBox2.Text + "'";

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