#2
厨师王德榜2019-10-22 13:52
|
程序代码:
conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & App.Path & "\datas\Data_Source.mdb" & "';Persist Security Info=False"
conn.Open
If rst.State = adStateOpen Then rst.Close
rst.Open "SELECT * FROM MsysObjects", conn, adOpenKeyset, adLockOptimistic
For intloop = 0 To rst.RecordCount - 1
If rst.Fields("name") = "NRCellDU" & "_" & ComDU_Type Then
kill = 1
End If
rst.MoveNext
Next intloop
If ComDU_Type = "" Then
MsgBox "请选择NRCellDU类型都再确认导入!", vbInformation, "Yams"
Exit Sub
Else
If kill = 1 Then
If MsgBox("<NRCellDU_" & ComDU_Type & ">已经存在,是否删除后重新导入?", vbCritical + vbOKCancel, "删除警告") = vbOK Then
conn.Execute "DROP TABLE NRCellDU_" & ComDU_Type
SQL = "select * into NRCellDU_" & ComDU_Type & " from [Excel 12.0 Xml;database=" & txtNRCellDU & "].[NRCellDU$]"
conn.Execute SQL
Else
Exit Sub
End If
Else
SQL = "select * into NRCellDU_" & ComDU_Type & " from [Excel 12.0 Xml;database=" & txtNRCellDU & "].[NRCellDU$]"
conn.Execute SQL
End If
End If
conn.Open
If rst.State = adStateOpen Then rst.Close
rst.Open "SELECT * FROM MsysObjects", conn, adOpenKeyset, adLockOptimistic
For intloop = 0 To rst.RecordCount - 1
If rst.Fields("name") = "NRCellDU" & "_" & ComDU_Type Then
kill = 1
End If
rst.MoveNext
Next intloop
If ComDU_Type = "" Then
MsgBox "请选择NRCellDU类型都再确认导入!", vbInformation, "Yams"
Exit Sub
Else
If kill = 1 Then
If MsgBox("<NRCellDU_" & ComDU_Type & ">已经存在,是否删除后重新导入?", vbCritical + vbOKCancel, "删除警告") = vbOK Then
conn.Execute "DROP TABLE NRCellDU_" & ComDU_Type
SQL = "select * into NRCellDU_" & ComDU_Type & " from [Excel 12.0 Xml;database=" & txtNRCellDU & "].[NRCellDU$]"
conn.Execute SQL
Else
Exit Sub
End If
Else
SQL = "select * into NRCellDU_" & ComDU_Type & " from [Excel 12.0 Xml;database=" & txtNRCellDU & "].[NRCellDU$]"
conn.Execute SQL
End If
End If
只有本站会员才能查看附件,请 登录
以上是vb6的部分代码,用如何实现呢?