未处理的“System.Data.OleDb.OleDbException”类型的异常出现在 system.data.dll 中。
cn.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;data source=d:\cs\1.xls;Extended Properties=Excel8.0"
' Select the data from Sheet1 of the workbook.
cn.Open()
昨天下班前还能正常运行,今天早上就报错
未处理的“System.Data.OleDb.OleDbException”类型的异常出现在 system.data.dll 中。
问题点数:0、回复次数:5Top
1 楼mazekui(悠悠春竹)回复于 2005-03-03 09:48:04 得分 0
"provider=Microsoft.Jet.OLEDB.4.0;data source=d:\cs\1.xls;Extended Properties=Excel8.0"
改成
"provider=Microsoft.Jet.OLEDB.4.0;data source=d:\\cs\\1.xls;Extended Properties=Excel8.0"
试试
Top
2 楼blueraindrop(blueraindrop)回复于 2005-03-03 09:49:28 得分 0
cn.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;data source=d:\cs\1.xls;Extended Properties=Excel8.0"
' Select the data from Sheet1 of the workbook.
cn.Open()
现在出现提示oledb驱动未注册Top
3 楼youlongzaitian(游龙在天)回复于 2005-03-03 09:59:38 得分 0
重新引用了看看!Top
4 楼blueraindrop(blueraindrop)回复于 2005-03-03 10:51:39 得分 0
youlongzaitian(游龙在天)
我现在想把excel中的数据取出来放到数据库中
Dim cm As New System.Data.OleDb.OleDbCommand
Dim cn As New System.Data.OleDb.OleDbConnection
Dim rs As System.Data.OleDb.OleDbDataReader
cn.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;data source=d:\cs\1.xls;Extended Properties=Excel 8.0"
' Select the data from Sheet1 of the workbook.
cn.Open()
cm.Connection = cn
cm.CommandText = "select * from [Sheet1$]"
rs = cm.ExecuteReader
While rs.Read
Dim xh As String = "0"
If rs.GetValue(4).GetType.Name <> "DBNull" Then
xh = rs.GetValue(4)
Else
xh = rs.GetDouble(4)
End If
现在取出来的只要是第四列第一行是字符型的,第四列第二行以后的数字型就都取不出来数据
我现在想从第二行选出来怎么解决
End While
Top
5 楼foolnet(foolnet)回复于 2005-03-03 11:09:34 得分 0
你查看异常信息呀Top




