求助:EXCEL与ACCESS之间数据导入与导出的问题
在ACCESS中有一个表TEST,有165个字段,需要导出成EXCEL,修改部分数据后,再导回到数据库的原表中,请问大家用VB.NET怎么实现.附上我的代码:
Dim conn As New ADODB.Connection Dim successout As Boolean = False LogChance() If LogFileName <> "" Then Dim ExcelPath As String = LogFileName If ExtenName = ".xls" Then conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" & ExcelPath & "';Extended Properties=Excel 8.0;") End If Dim strSQL As String strSQL = "Insert Into [;database=" & DataPath & "]." & TableName & " Select * FROM [" & TableName & "$]" Try conn.Execute(strSQL) successout = True MsgBox("数据导入完毕", MsgBoxStyle.Information, "提示信息") Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Exclamation, "提示信息") successout = False conn = Nothing Exit Sub Finally conn = Nothing End Try Else successout = False MsgBox("请选择文件", MsgBoxStyle.Exclamation, "提示信息") conn = Nothing Exit Sub End If