一、从服务器创建到客户端: Public Sub Main3() '当创建成功后,如果要再次创建,请删除已创建的表,否则提示出错 Dim Cnxn As ADODB.Connection Dim Cnxn_source As ADODB.Connection Dim rstTitles As ADODB.Recordset Dim strSQLRestore As String Dim strCnxn_source As String Dim strSQLTitles Dim strCnxn As String '数据库设有密码:123456 strCnxn_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & CurrentProject.Path & "\ado001_be.mdb" & ";jet oledb:database password=123456" '数据为密码为空 ' strCnxn_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & CurrentProject.Path & "\ado001_be.mdb" Set Cnxn_source = New ADODB.Connection Cnxn_source.Open strCnxn_source strSQLRestore = "SELECT * INTO tblUser_make FROM [MS Access;DATABASE=" & CurrentProject.Path & "\ado001_be.mdb;UID=admin;PWD=123456].[tblUser]" ' strCnxn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & CurrentProject.Path & "\ado001.mdb" strCnxn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & CurrentProject.Path & "\ado001.mdb;" Set Cnxn = New ADODB.Connection Cnxn.Open strCnxn Set rstTitles = New ADODB.Recordset Cnxn.Execute strSQLRestore, , adExecuteNoRecords Cnxn.Close Set rstTitles = Nothing Set Cnxn = Nothing MsgBox "已成功执行此操作" Exit Sub End Sub
|
别人笑我太疯 | |