Dim sPath As String
sPath = Text1.Text
Dim db As New ADODB.Connection
Dim rs As New ADODB.RecordsetIf Text1 = "" Then
MsgBox "请选择文件路径", 48, "终检管理系统"
Exit Sub
End If db.Open "Provider=Microsoft.ace.OLEDB.12.0;Data Source=" & App.Path & "\storage.accdb" & ";Persist Security Info=False"
Call db.Execute("INSERT into 临时表 SELECT * From [Sheet1$] In '" & sPath & "' 'excel 8.0;'")
db.Close
Set db = Nothing
Adodc1.ConnectionString = "Provider=Microsoft.ace.OLEDB.12.0;Data Source=" & App.Path & "\storage.accdb" & ";Persist Security Info=False"
Adodc1.RecordSource = "select * from 终检档案 inner join 临时表 on 终检档案.管号= 临时表.管号 and 终检档案.批号= 临时表.批号"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
MsgBox "数据重复", 48, "终检管理系统 "
cnn.Execute ("delete from 临时表")
Else
db.Open "Provider=Microsoft.ace.OLEDB.12.0;Data Source=" & App.Path & "\storage.accdb" & ";Persist Security Info=False"
Call db.Execute("INSERT into 终检档案 SELECT * From [Sheet1$] In '" & sPath & "' 'excel 8.0;'")
MsgBox "导入成功", vbOKOnly, "提示"
db.Close
Set db = Nothing
cnn.Execute ("delete from 临时表")
End If
Text1 = ""
以上代码是 excel导入ACCESS中,同样导SQL代码怎样更改sql
sPath = Text1.Text
Dim db As New ADODB.Connection
Dim rs As New ADODB.RecordsetIf Text1 = "" Then
MsgBox "请选择文件路径", 48, "终检管理系统"
Exit Sub
End If db.Open "Provider=Microsoft.ace.OLEDB.12.0;Data Source=" & App.Path & "\storage.accdb" & ";Persist Security Info=False"
Call db.Execute("INSERT into 临时表 SELECT * From [Sheet1$] In '" & sPath & "' 'excel 8.0;'")
db.Close
Set db = Nothing
Adodc1.ConnectionString = "Provider=Microsoft.ace.OLEDB.12.0;Data Source=" & App.Path & "\storage.accdb" & ";Persist Security Info=False"
Adodc1.RecordSource = "select * from 终检档案 inner join 临时表 on 终检档案.管号= 临时表.管号 and 终检档案.批号= 临时表.批号"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
MsgBox "数据重复", 48, "终检管理系统 "
cnn.Execute ("delete from 临时表")
Else
db.Open "Provider=Microsoft.ace.OLEDB.12.0;Data Source=" & App.Path & "\storage.accdb" & ";Persist Security Info=False"
Call db.Execute("INSERT into 终检档案 SELECT * From [Sheet1$] In '" & sPath & "' 'excel 8.0;'")
MsgBox "导入成功", vbOKOnly, "提示"
db.Close
Set db = Nothing
cnn.Execute ("delete from 临时表")
End If
Text1 = ""
以上代码是 excel导入ACCESS中,同样导SQL代码怎样更改sql
解决方案 »
- 在VB6中如何只显示窗体的最小化按钮,而不显示关闭和最大化按钮
- Label显示的文字是否有办法选中并拷贝?
- 谁有VB+ACCESS的学习资料或书籍?
- the OCX of SpreadSheet
- 三个表扬
- 如何判断菜单(MENU)存在
- vb的工程属性窗口里面出现乱码,怎么解决?
- 在VB程序打包后运行时,提示:从MMBT_OSXE1.OCX加载控"MMBT_OSXE1.OCX"件失败,你的MMBT_OSXE1.OCX控件版本可能过期,确认您使用的控件版本是同您的应用程序一起提供的
- 如何采用多线程来同时播放多个声音文件(*.wav),请大家帮忙?
- 奇怪,我用vb开发数据库(ado),居然有这样问题。。。helpme
- 调用dll做到对excel文件vba进行处理
- 请高手帮忙看看excel导入sql数据库的问题给分100
--直接修改成 mssql联接语句就行......