我是菜鸟啊前面的连接数据库没问题comm_erp=new ....
comm= new Sqlcommand("select * from md_invinfo where cinvcode="+textbox1.text,conn_erp);ada =new Sqldataadapter(comm);
dt =new datatable();
ada.fill(dt);
datagridview1.datasource=dt;
提示:17 附近有语法错误

解决方案 »

  1.   

    comm= new Sqlcommand("select * from md_invinfo where cinvcode='"+textbox1.text+"'",conn_erp);
      

  2.   

    comm= new Sqlcommand("select * from md_invinfo where cinvcode='"+textbox1.text,conn_erp+"'");
      

  3.   

    对于字符串,sql规定需要加 ' 单引号,所以你在拼串的时候,得加上,如楼上!
      

  4.   

    comm= new Sqlcommand("select * from md_invinfo where cinvcode='"+textbox1.text+"'",conn_erp);ada =new Sqldataadapter(comm); 
    改成这样试试