|
Hi All, I am very new to vb.net and I have a problem while retriving certian columns from an excel sheet....its a windows application which i am working on.... I have 14 columns in my excel sheet...one of the column has integer as well as text values...i am able to retrieve only the integer values but i am not able to retrieve the text values present in that column, i get a blank value... when it is a text
I have even set the "IMEX=1" property in the connection string....
Here the code what i am using to load the excel sheet...
Dim Con_Str As String = "provider=Microsoft.Jet.OLEDB.4.0;data source= C:\Documents and Settings\administrator\Desktop\INVOICE.xls;Extended Properties=""Excel 8.0;HDR=YES;IMEX=1"""
Dim con As New OleDbConnection(Con_Str)
If con.State = ConnectionState.Open Then con.Close() End If con.Open() Dim StrQry As String = "Select * from [1047$]" Dim cmd As New OleDbCommand(StrQry, con) Dim da As New OleDbDataAdapter(cmd) Dim Ds As New DataSet da.Fill(Ds, "Excel") dgrExcelContents.DataSource = Ds.Tables("Excel") con.Close()
Can anyone tell me where am I going wrong
|