Using Tableadapter created in a .dll in Windows forms application RRS feed

  • Question


    Hello everybody,


    I just stumbled about a problem I don't know how to solve. I'm about to build a project using a ASP.NET website for some input and on the other hand a Windows Forms Application for the location based part of the program.

    My idea was to build up a .dll to access the Database from all programs (maybe in the future more programs want to connect to the database).

    So I created a new .dll and in the dll I created a new DataSet, because this seems to be a very clean way to connect to the database. DataSet means a .xsd File. I dragged in the DB Tables from the Server explorer.

    In my ASP.NET Application I can use a ObjectDataSource referencing a Tableadapter in the dll. I can connect it to a GridView and I see the Data in the grid. Insert, Update, delete in code aren't a problem, too.


    Now I wanted to do the same in a Windows Forms application. I select ObjectDataSource as DataSource for data DataGridView. The problem now is that the ObjectDataSource doesn't seem to represent the DB Grid, but the DataTable class itself, because in the DataGridView I only see the properties of the Object I select (in this case the TableAdapter).


    If I build up a new DataSet in my Windows forms Database I can easily use it for the DataGridView.


    Did anybody have a similar problem or can anyone help?


    Thanks in advance,


    Florian Fanderl

    Tuesday, June 24, 2008 12:57 PM


  • Meanwhile I found it out myself Smile


    I did everything the right way, but I just missed to fill the DataSet. If I create a new DataSet a Fill command is automatically added to the OnLoad Event of the form. I just didn't see it Smile


    if I do




    it works perfect Smile


    Thanks anyways to everybody thinking about the problem!



    Florian Fanderl

    Wednesday, June 25, 2008 8:14 AM