怎样利用VB将EXCEL中的数据导入ACCESS

来源:百度知道 编辑:UC知道 时间:2024/05/22 19:53:05

Dim extend_str As String
Dim execl_cnn As New ADODB.Connection

Dim execl_rst As New ADODB.Recordset
Dim execl_count_rst As New ADODB.Recordset '纪录数量
Dim execl_field_rst As New ADODB.Recordset

Dim execl_strconn As String
Dim execl_strcmd As String
Dim execl_count_str As String
Dim insertStr As String

'操作oracle数据库的记录集
Dim rst As ADODB.Recordset

CommonDialog1.ShowOpen
extend_str = Right(CommonDialog1.FileName, 3)

If (extend_str = "xls") Then
execl_cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & CommonDialog1.FileName & _
";Extended Properties=Excel 8.0;"
ElseIf (extend_str = "dbf") Then
execl_cnn.ConnectionString = "Provider=MSDASQL.1;Driver=Microsoft Visual Foxpro Driver;SourceType=DBF;DBQ=" &