现有一表 a结构如下:
ID(自动编号)   ProductName
1              螺丝
2              剪刀
3              螺母
...            ...
我想用Insert into 来新增一条记录,VB语句应该怎么写?我写了以下一段,其中第一个自动编号的字段应该怎么写呢?(以下语句执行时会报错)
strQuery = "Insert into a values('" & intId + "'" & strProductName + " ')'"
Cn.Execute strQuery

解决方案 »

  1.   

    strQuery = "Insert into a values(" & strProductName + " ')'" 
      

  2.   

    insert a(productname) values('螺丝刀')
      

  3.   


    ID(自动编号)好像不用写
    strQuery  = " insert into  a ( ProductName ) values ('"+strProductName+"')";
      

  4.   

    插入前
    SET IDENTITY_INSERT 表名 ON
    插入结束SET IDENTITY_INSERT 表名 OFF