oleStr5 ="insert into [student]([]) values(" + m + ") where id="+ sid +" and tid="+ ds.Tables[0].Rows[0]["id"] +"";报“SQL语句结束位置缺少分号(;)"的错误,为什么!

解决方案 »

  1.   

    oleStr5 ="insert into [student]([]) values(@paramMark) where id=@id and tid=@tid";SqlCommand1.Parameters.AddWithValue("@paramMark", );
    SqlCommand1.Parameters.AddWithValue("@id", id);
    SqlCommand1.Parameters.AddWithValue("@tid", ds.Tables[0].Rows[0]["id"]);SqlCommand1为SqlCommand对象名称。
      

  2.   

    console.writeline (oleStr5 ); 把生成的SQL语句贴出来看一下,应该是语法错误。
      

  3.   

    insert into  where?这个语法有问题吧
    oleStr5="update student set  ="+m+"where id="+sid+"and tid="+ds.Tables[0].Rows[0]["id"].ToString();
      

  4.   

    LZ是想修改数据库中的数据么?怎么用insert into …… where ……啊?
    update  ……  where……
    另外 用单引号 ds.Tables[0].Rows[0][‘id’] +"";
      

  5.   

    1。想修改 字段值 用  update 表名  set 字段=值 Where 条件
    2。想从一个表中 取值 插入另一个表中 用  insert into A表 (字段) select 字段 from B表 where 条件
    3。从A表中 取值 创建 B表  用 select 字段 into B表 from A表 where 条件
      

  6.   

    insert into xxx select from xxxx where 
      

  7.   

    oleStr5 ="insert into (student, ) values(" + m + ") where id="+ sid +" and tid="+ ds.Tables[0].Rows[0]["id"] +"";这样行不行
      

  8.   


    insert into 语法哪里有问题?
      

  9.   

    解决问题了,谢谢大家了,我错了,insert语句居然用where