将某数据库,如XX中的表YY和ZZ导出(备份)成ACCESS,将ACCESS表导入覆盖XX中的表YY和ZZ?谢谢!请给出源码,再次感谢!

解决方案 »

  1.   

    要两个数据库连接,取出SQLSERVER中的数据然后写入ACCESS中,只有这样
      

  2.   

    请给我源码好吗?我调试过了后,马上结算100分。表YY和表ZZ无关
      

  3.   

    这个问题,我回家才能解决,现在没资料思想是:建立access数据库-按照xxyy表格式建立access数据表
            读取sql数据库 , 写入access数据表难点就是怎么创建表
      

  4.   

    '首先建立两个连接
    Sub Main()
    With con
    On Error Resume Next
        conAss.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
                                  "Data Source=ShopAcc.mdb;" & _
                                  "Persist Security Info=False"
        conAss.Open
        If conAss.State <> 1 Then
            MsgBox "连接数据库失败,请检查ODBC配置及服务器状态!", vbCritical, "连接错误"
            Set con = Nothing
            End
        End If
        .ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;" & _
                            "User ID=sa;Data Source=shop"
        .CursorLocation = adUseClient
        .Open
        If .State <> 1 Then
            MsgBox "连接数据库失败,请检查ODBC配置及服务器状态!", vbCritical, "连接错误"
            Set con = Nothing
            End
        End If
        frmLogin.Show
    End With
    End Sub
      

  5.   

    '然后把要存入ACCESS的表内容写成一个SQL语句执行就可以了
    Function AddGdsid() As Boolean
    Dim strAddGds As String
    Dim strAddDepgds As String
    '增加商品编码
        strAddGds = "INSERT INTO gds " & _
           "( gdsid, clsid, gdsdes, srtcde, spc, bsepkg, mftfct, taxrto, " & _
           "saltaxrto, rfnprc, rfntaxprc, salprc, discctrl, isclsgds, isunngds, " & _
           "istaxlbr, udtpsn, udtdtm, isstpsal, isstp, rctusedat ) VALUES ( " & _
           "'" & txtGdsid & "', '" & txtClsid & "', '" & txtGdsdes & "', '" & txtSrtcde & _
           "', '/', '/', '" & txtMftfct & "', 0.17, 0.17, 0, 0, " & _
           txtSalprc & ", 'n', 'n', 'n', 'n', '0', '" & _
           Format(Date, "yyyymmdd") & "000000', 'n', 'n', '" & Format(Date, "yyyymmdd") & "' )"
    On Error GoTo AddErr
        conAss.Execute strAddGds
        con.Execute strAddGds'增加到柜组
        strAddDepgds = "INSERT INTO depgds " & _
             "( depid, gdsid, depdes, isvld, udtpsn, udtdtm ) VALUES ( " & _
             "'" & txtDepid & "', '" & txtGdsid & "', '" & txtDepdes & "', 'y', '0', '" & _
             Format(Date, "yyyymmdd") & "000000' )"
        conAss.Execute strAddDepgds
        con.Execute strAddDepgds    MsgBox "新编码已保存!", vbInformation, "保存成功"
        AddGdsid = True
        Exit Function
    AddErr:
        MsgBox "新编码失败,错误原因:" & Err.Description, vbInformation, "保存失败"
        AddGdsid = False
        Exit Function
    End Function
      

  6.   

    你產生一個 Access 表,然後將值回填就好了。
      

  7.   

    SQL自己有DTS的功能,你可以看看
      

  8.   

    http://blog.csdn.net/litp/archive/2004/09/07/96494.aspx
      

  9.   

    1、如果SQL Server在本地,可以直接导入和导出,通过openrowset,可以查一下sql server的帮助,
    2、如果不在本地,只能通过建表的方式。
      

  10.   

    在程序中执行语句
    insert into openrowset('Microsoft.Jet.OLEDB.4.0',
      'x:\A.mdb';'admin';'',A表) select * from  sql的数据库名..SQL的数据表
      

  11.   

    我做过的,很好用.思路:::
    1\事先建一个与SQL一样的结果的库(手工作就可以,如以下:sell.mdb).
    2\打开SQL,打开ACCESS,把SQL的记录存到access.
    3\用FileCopy "D:\\sell.mdb", "D:\sellbak.fwy"
    4\sellbak.fwy就是备份文件.
    5\导也就可以用sell.fwy导入了.是不是很简单呢