Dim rs As New ADODB.Recordset 
rs.Open "select * from test where 1=0",g_Conn, adOpenKeyset, adLockOptimistic
  if rs.eof then
    rs.AddNew
    rs.Fields("fileda") = text1.text
    rs.Fields("filedb") = text2.Text
    rs.Update
    rs.Close
 end if

解决方案 »

  1.   

    1:
    cn.execute "insert into test values('" & text1.text & "','" & text2.text & "')"
    2:
    cn.execute "insert into test values('" & text1.text & "','" & text2.text & "','','','')"
      

  2.   

    楼上的兄弟呀,这样的办法你也想得出来,居然用空值,这个方法也太笨了吧,如果我的表里有一百多个字段,你难不成想写100多个空字符to: axzywan (毛利元就)  
    你发给我的消息,我已经给你回了,里面也写了解决办法,我想你现在应该已经搞定了吧
      

  3.   

    我的目的就是抛砖引玉,快速解决问题而已。你行,好了吧,千里讽刺只为分,让你一万又何妨。
    cn.execute "insert into test (fielda,fieldb) values('" & text1.text & "','" & text2.text & "')"
      

  4.   

    cn.execute "insert into test (fileda,filedb) values('张三','test')这样没有列出的字段会自动为空(前提:字段可以为空。)