Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 149,934 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,517 people online right now. Registration is fast and FREE... Join Now!




Excel Loading Problem

 
Reply to this topicStart new topic

Excel Loading Problem

archana.renu
18 Dec, 2007 - 02:36 AM
Post #1

New D.I.C Head
*

Joined: 18 Dec, 2007
Posts: 1


My Contributions
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
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 03:56PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month