以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]运行错误,求指点  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=51760)

--  作者:xiaoyongxg2
--  发布时间:2014/6/3 0:13:00
--  [求助]运行错误,求指点
Dim dlg As New OpenFileDialog \'定义一个新的OpenFileDialog
dlg.Filter= "excel|*.xls" \'设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮
    Dim ip As New Importer
    ip.SourcePath = dlg.FileName \'指定数据文件
    ip.SourceTableName = "*" \'指定要导入的表为任意想导入的表
    ip.NewTableName ="订单" \'导入后的表名
    ip.Import()
End If

结果:SELECT 子句中包含一个保留字、拼写错误或丢失的参数,或标点符号不正确

--  作者:sloyy
--  发布时间:2014/6/3 0:43:00
--  
ip.SourceTableName = "*" \'指定要导入的表为任意想导入的表 这句可能错了
应该是OpenFileDialog获得的文件名

--  作者:xiaoyongxg2
--  发布时间:2014/6/3 11:45:00
--  
问题没有得到解决,这样也会出错
Dim dlg As New OpenFileDialog \'定义一个新的OpenFileDialog
dlg.Filter= "excel文件|*.xls" \'设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮
    Dim ip As New Importer
    ip.SourcePath = dlg.FileName \'指定数据文件
    ip.SourceTableName = "订单" \'指定要导入的表
    ip.NewTableName ="订单" \'导入后的表名
    ip.Import()
End If
SELECT 子句中包含一个保留字、拼写错误或丢失的参数,或标点符号不正确

--  作者:有点甜
--  发布时间:2014/6/3 12:19:00
--  
 Dim dlg As New OpenFileDialog \'定义一个新的OpenFileDialog
dlg.Filter= "excel文件|*.xls" \'设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮
    Dim ip As New Importer
    ip.SourcePath = dlg.FileName \'指定数据文件
    ip.SourceTableName = "订单$" \'指定要导入的表
    ip.NewTableName ="订单" \'导入后的表名
    ip.Format = "excel"
    ip.Import()
End If
[此贴子已经被作者于2014-6-3 12:20:26编辑过]

--  作者:xiaoyongxg2
--  发布时间:2014/6/6 8:17:00
--  
谢谢,你提供的方法解决了我的问题