Private Sub cmdxz_Click()
Dialog.DialogTitle = "选择文件"
Dialog.ShowOpen
Dim Filename As String
If Dialog.Filename <> "" Then
Filename = Dialog.Filename
cnXsl.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Filename & ";Extended Properties=Excel 8.0;Persist Security Info=true"
cnXsl.CursorLocation = adUseClient
Dim rst As New ADODB.Recordset
rst.Open "T1", cnXsl, adOpenKeyset, adLockOptimistic
If Not (rst.EOF And rst.BOF) Then
Set Grid.Recordset = rst
End If
rst.Close
cnXsl.Close
End If
End Sub
然后在rst时出现无效的sql语句为什么啊,我引用的是excel 9.0
Dialog.DialogTitle = "选择文件"
Dialog.ShowOpen
Dim Filename As String
If Dialog.Filename <> "" Then
Filename = Dialog.Filename
cnXsl.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Filename & ";Extended Properties=Excel 8.0;Persist Security Info=true"
cnXsl.CursorLocation = adUseClient
Dim rst As New ADODB.Recordset
rst.Open "T1", cnXsl, adOpenKeyset, adLockOptimistic
If Not (rst.EOF And rst.BOF) Then
Set Grid.Recordset = rst
End If
rst.Close
cnXsl.Close
End If
End Sub
然后在rst时出现无效的sql语句为什么啊,我引用的是excel 9.0
解决方案 »
- 关于API函数GetDC()的问题,有一个单词的意思不懂!望大侠指点!
- (简单入门题)求算法,并指出我的错误
- 增加记录字段的类型问题
- 将5角钱用1、2、5分硬币找零,不要完全相同种类的硬币方案,显示所有方案。
- 在按钮或option 控件变灰后,如何停止接受鼠标的输入(急)
- 如何同时调用2个已做好的水晶报表
- 那里有MSDN下载?
- to:sworddx(剑宇潇湘) 征求 XP 菜单控件源码,分不够再给!
- 如何调用API来实现关闭计算机
- 关于DataReport的问题!!!!
- 在线求教,怎么得到数据库中一个表的结构,即这个表的每个字段的定义?
- 各位大侠!我是一个VB出学者!我怎样才能在程序中创建一个数据库?需要什么控件呢?
去掉引号试试