Results 1 to 2 of 2

Thread: Array from excel

  1. #1

    Thread Starter
    Addicted Member soluga's Avatar
    Join Date
    Dec 2005
    Location
    Manchester (Uk)
    Posts
    211

    Array from excel

    Hi
    I am trying to build an array from an excel spread sheet, I can connect to the sheet fine and pull out a dataset, but I dont know how to populate the array, my code is below, would be grateful for any help.
    Thanks

    VB Code:
    1. Dim myDataset As New DataSet()
    2.         Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    3.         "Data Source=" & Server.MapPath("/autoexcel/") & "excel/" & strFileNameOnly & ";" & _
    4.         "Extended Properties=Excel 8.0;"
    5.         lblMessage.Text = strFileNameOnly
    6.         ''You must use the $ after the object you reference in the spreadsheet
    7.         Dim myData As New OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn)
    8.         myData.TableMappings.Add("Table", "ExcelTest")
    9.  
    10.         myData.Fill(myDataset)
    11.  
    12.         Dim resultArray As Array
    13.         resultArray = ?????????

  2. #2

    Thread Starter
    Addicted Member soluga's Avatar
    Join Date
    Dec 2005
    Location
    Manchester (Uk)
    Posts
    211

    Re: Array from excel

    Doesnt matter, have decided to use a datatable instead.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width