例如
INSERT INTO Customers " SELECT * FROM [New Customers];"

解决方案 »

  1.   

    INSERT INTO Customers  SELECT * FROM [New Customers]
      

  2.   

    可以在后面的
    select语句中
    加条件
    where
      

  3.   

    Dim conn As New ADODB.Connection
     Dim cors As New ADODB.Recordset
     Dim strsql As String
      conn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;" _
    & "Data Source=" & App.Path & "\****.mdb;Jet OLEDB:database ")
    strsql="select * from table where 条件"
    cors.open strsql,conn,3,1
    do while not cors.eof
      conn.execute("insert into table(**,**,...,**) value('" & cors("**") & "',...)")
      cors.movenext
    loop
    cors.close
    set cors=nothing
    conn.close
    set conn=nothing
      

  4.   

    我忘了command对象如何建立了
    我不想去查了
    给个代码吧
      

  5.   

    当然你可以先把数据从数据库里拿出来 
    在insert 语句把它写到另一个数据库
      

  6.   

    不好意思,我从来不用command所以,不会:(
      

  7.   

    那另一个数据库用不用打开呢?
    是不是要打开两个conncetion然后把一个库中的记录读出
    然后?
    如何插入第二个库中呢?
    怎么写?
      

  8.   

    哦,对,是的,需要写两个数据库连接
    Dim conn As New ADODB.Connection
    Dim conn2 As New ADODB.Connection
     Dim cors As New ADODB.Recordset
     Dim strsql As String
    '第一个连接
      conn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;" _
    & "Data Source=" & App.Path & "\****.mdb;Jet OLEDB:database ")
    '第二个连接
    conn2.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;" _
    & "Data Source=" & App.Path & "\****.mdb;Jet OLEDB:database ")strsql="select * from table where 条件"
    cors.open strsql,conn,3,1
    do while not cors.eof
      conn2.execute("insert into table(**,**,...,**) value('" & cors("**") & "',...)")
      cors.movenext
    loop
    cors.close
    set cors=nothing
    conn.close
    set conn=nothing
    conn2.close
    set conn2=nothing
      

  9.   

    就是把一个recordset中的记录
    插到另外一个recordset中
      

  10.   

    可以这么说吧,插入直接这样写就行了
    conn2.execute("insert into table(***) value(***)")
      

  11.   

    我觉得还是定义两个数据库连接
    '定义recordset,connection并打开
    dim strSqlSelect as string
    dim strSqlInsert as string
    strSqlSelect="SELECT * FROM A"
    rsSelect.open strSqlSelect,cnSelect,1,3
    dim i as integer
    dim iCount as integer
    iCount =rsSelect.recordcount
    for i=1 to iCount 
       strSqlInsert="INSERT INTO B (...) VALUES (" & rsSelect("f1Name") & ... & ")
       on error resume next
            cnInsert.execute strSqlInsert
       if err.number<>0 then
            msgbox err.description'如果可能在后面加上回滚操作 RollBack
       endif
       rsSelect.movenext
    next'释放对象