none
ListObject Usage: 2 way Databinding RRS feed

  • Question

  • Hi,

    I would like to use the ListObject to populate an excel (2007) sheet with data from a database. I also want to be able to upload all changes to the data or a certain range back to sql (2008)

    I am not sure where to begin.

    I'd appreciate a pointer.

    Monday, September 3, 2012 1:59 PM

Answers

  • Hi Kudah,

    Thanks for posting in the MSDN Forum.

    We must clarify the way to use listobject before we begin to discuss your issue. As far as I know, you can binding data to listobject via UI manner, VBA project and Microsoft.Office.Tools.Excel namespace. And there exist an Excel document project and an Excel VBA project to approach your goal. I would recommend you create an Excel document project such as an Excel Workbook project, Excel Template project via Visual Studio to handle your issue. I suppose you have a database which content a Table named "Table1" and you will binding "Table1" on ListObject which named "list1". When we binding the database to ListObject, visual studio will generate "database1DataSet", "tabel1TableAdapter" by itself. When we change the vale in the "list1" we are able to perform following code to update change:

                table1TableAdapter.Update(database1DataSet);
                table1TableAdapter.Fill(database1DataSet.Table1);

    I hope it can help you.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, September 4, 2012 5:47 AM
    Moderator