求助:关于vb.net导入excel到access的问题
我是菜鸟,刚刚接触,请问如何把一个excel表里面指定sheet导入到access里面和sheet名相同table里面,如果里面存在同名table,询问是追加进去还是删除后重新建一个table。程序代码:
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
Snap2.rar
(1.63 KB)
以上是vb6的部分代码,用如何实现呢?