"在工程---部件中新增 microsoft ADO data contcrol 6.0
"在窗體新增兩個adodc控制元件,分別連線好資料庫和所需匯入匯出的表
"adodc1連線要匯入的表,adodc2連線要匯出的表
Private Sub Command1_Click()
Dim i, j As Integer
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
Adodc2.Recordset.MoveFirst
For j = 1 To Adodc2.Recordset.RecordCount
Adodc1.Recordset.AddNew "新增一條空記錄
For i = 0 To Adodc2.Recordset.Fields.Count - 1
Adodc1.Recordset.Fields(i).Value = Adodc2.Recordset.Fields(i).Value
Next i
Adodc2.Recordset.MoveNext
Next j
Adodc1.Recordset.Update
Else
MsgBox "表2沒有資料可入導表2"
End If
End Sub
"在工程---部件中新增 microsoft ADO data contcrol 6.0
"在窗體新增兩個adodc控制元件,分別連線好資料庫和所需匯入匯出的表
"adodc1連線要匯入的表,adodc2連線要匯出的表
Private Sub Command1_Click()
Dim i, j As Integer
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
Adodc2.Recordset.MoveFirst
For j = 1 To Adodc2.Recordset.RecordCount
Adodc1.Recordset.AddNew "新增一條空記錄
For i = 0 To Adodc2.Recordset.Fields.Count - 1
Adodc1.Recordset.Fields(i).Value = Adodc2.Recordset.Fields(i).Value
Next i
Adodc2.Recordset.MoveNext
Next j
Adodc1.Recordset.Update
Else
MsgBox "表2沒有資料可入導表2"
End If
End Sub