老师好:
用excel作为数据源已成功设置好数据源,但查询生成临时表,执行时的参数设置为假可以。设置为真时代码执行出错。
Dim cmd As new SQLCommand
cmd.C
cmd.CommandText = "S elect * from [" & "站址明细分解$" & "]"
Dim dt_excel As DataTable = cmd.ExecuteReader()
msgbox(dt_excel.DataRows.count) '这样可以返回正常的记录条数
Dim cmd As new SQLCommand
cmd.C
cmd.CommandText = "S elect * from [" & "站址明细分解$" & "]"
Dim dt_excel As DataTable = cmd.ExecuteReader(true)
msgbox(dt_excel.DataRows.count) '这样代码出错。有没有什么解决办法