Question

Locked

Excel Loading Problem

By archana.renu ·
Hi All....
I am working on Windows Application(VB.NET)
I ahve a problem loading Excel...I have 14 columns in Excel,one of the column has the Amount column which has "NUMBERS" as well "TEXT" values.i am able to retrieve the numbers but i am not able to retrieve the text values from that column...I have even set the "IMEX=1" property in the connection string...

Here is the code can anyone tell me where i am going wrong...


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").DefaultView
dgrExcelContents.AlternatingRowsDefaultCellStyle.BackColor = Color.LightCyan
con.Close()

This conversation is currently closed to new comments.

0 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to Software Forum
0 total posts (Page 1 of 1)  

Related Discussions

Related Forums