Announcement

Collapse
No announcement yet.

writing to Excel using VB.NET

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • writing to Excel using VB.NET

    Hey, Im having a small issue concerning writing to VB.Net and TextBoxs.

    Using the following code I can read from an Excel (.xls) file and populate it into an DropDownList:

    Dim MyConnection As System.Data.OleDb.OleDbConnection
    ''''''' Fetch Data from Excel
    Dim DtSet As System.Data.DataSet
    Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
    MyConnection = New System.Data.OleDb.OleDbConnection("provider=Micros oft.Jet.OLEDB.4.0; data source='<FILE PATH>'; " & "Extended Properties=Excel 8.0;")
    ' Select the data from Sheet of the workbook.
    MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [Employee$]", MyConnection)
    DtSet = New System.Data.DataSet
    MyCommand.Fill(DtSet)
    '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''
    DDLIndiv.DataSource = DtSet
    DDLIndiv.DataTextField = "First Name"
    DDLIndiv.DataBind()
    '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''
    MyConnection.Close()

    Now my research into this shows a very different way of doing it and requires the use of a datgridview. I was wondering if anyone knows a way of writing to the Excel file when I submit the form using OleDb rather then the Office built ins.

    - Thanks
    << Working together to prevent ID10T errors >>
Working...
X