VB.NET读取EXCEL文件中的数据有问题?
Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\binghe.xls" & ";Extended Properties=Excel 8.0;" '定义连接字符串Dim oleDbConnection As OleDbConnection = New OleDbConnection(sConnectionString)
oleDbConnection.Open()
'获取excel表
Dim dataTable As DataTable = oleDbConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, Nothing)
'利用SQL语句从Excel文件里获取数据
Dim query As String = "SELECT * FROM [sheet1$]"
Dim oleAdapter As OleDbDataAdapter = New OleDbDataAdapter(query, sConnectionString)
oleAdapter.Fill(dt)
这是我的读取代码
问题是:如果EXCEL表中某列的值有数字和字母,只能读取到字母(开头)的值,不知是何缘故