Excel data import problem

Discussion in 'ASP .Net' started by msnews.microsoft.com, Jun 26, 2006.

  1. Hi friends,

    First of all sorry for my not very good English.

    I have very strange problem, I have to import a data from excel sheet. I
    have 10 columns and all the data is coming properly except the data from one
    column. The data from this column is ok if it is some string but if the data
    is int the data just doesn't appear.

    I think it is some kind of formatting of the column of excel file but I did
    not find anything.

    Please if possible help me to solve the problem
    msnews.microsoft.com, Jun 26, 2006
    #1
    1. Advertising

  2. msnews.microsoft.com

    Mark Rae Guest

    "msnews.microsoft.com" <> wrote in message
    news:...

    > Please if possible help me to solve the problem


    It's almost impossible to help you if you don't at least show us:

    1) the code you're using

    2) the error message

    3) the line which generates the error
    Mark Rae, Jun 26, 2006
    #2
    1. Advertising

  3. msnews.microsoft.com

    Aron.B Guest

    That is my code, but I think the problem is not in my code.



    Dim cnExcel As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
    Source = " & sFile & ";Extended Properties=Excel 8.0;")

    cnExcel.Open()

    Dim cmdExcel As New OleDbCommand("SELECT * FROM [" &
    lookup.Rows(0)("TABLE_NAME") & "]", cnExcel)



    Dim objAdapter1 As New OleDbDataAdapter

    objAdapter1.SelectCommand = cmdExcel

    Dim objDataset1 As New DataSet

    objAdapter1.Fill(objDataset1, "XLData")



    DataGrid1.DataSource = objDataset1

    DataGrid1.DataBind()











    I can see all the columns with all the data except the data from one of the
    columns. And the strange think is that if I change the data in this column
    from int to string, it is working perfect.

    There is no error, just the data is not appear



    Any ideas?

    Thanks in advance
    Aron.B, Jun 26, 2006
    #3
  4. msnews.microsoft.com

    sloan Guest

    At the least.. after you line:

    objDataset1

    find the objDataset1.GetXml()

    and examine it in nodepad.exe . That will help ....

    You need to decouple the DataSet get, and the Bind() method to see which one
    is killing it.




    "Aron.B" <> wrote in message
    news:...
    > That is my code, but I think the problem is not in my code.
    >
    >
    >
    > Dim cnExcel As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
    > Source = " & sFile & ";Extended Properties=Excel 8.0;")
    >
    > cnExcel.Open()
    >
    > Dim cmdExcel As New OleDbCommand("SELECT * FROM [" &
    > lookup.Rows(0)("TABLE_NAME") & "]", cnExcel)
    >
    >
    >
    > Dim objAdapter1 As New OleDbDataAdapter
    >
    > objAdapter1.SelectCommand = cmdExcel
    >
    > Dim objDataset1 As New DataSet
    >
    > objAdapter1.Fill(objDataset1, "XLData")
    >
    >
    >
    > DataGrid1.DataSource = objDataset1
    >
    > DataGrid1.DataBind()
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > I can see all the columns with all the data except the data from one of

    the
    > columns. And the strange think is that if I change the data in this column
    > from int to string, it is working perfect.
    >
    > There is no error, just the data is not appear
    >
    >
    >
    > Any ideas?
    >
    > Thanks in advance
    >
    >
    sloan, Jun 26, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sudha

    Need to import data to excel

    sudha, Jun 26, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    485
    sudha
    Jun 26, 2003
  2. Rathtap
    Replies:
    0
    Views:
    2,143
    Rathtap
    Jun 30, 2003
  3. Sreedhar Vankayala
    Replies:
    2
    Views:
    13,548
    Sreedhar Vankayala
    Feb 25, 2004
  4. Schultz

    Import data from excel to dataset

    Schultz, May 6, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    28,320
    =?Utf-8?B?Q2hyaXMgUm9zcw==?=
    May 6, 2005
  5. =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=

    Problem with Excel reports ::::Excel 2003 Migration To Excel 2007

    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=, Oct 5, 2007, in forum: ASP .Net
    Replies:
    15
    Views:
    1,494
    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=
    Oct 24, 2007
Loading...

Share This Page