databinding trouble (Relational Databases)

I have a large database that I exported via ODBC to Access format. I have loaded this into VB with no problem and I can view the data using the standard tools, but I'm having trouble getting everything to talk together. Let me explain.

I have one table called Doors and another one called DoorTypes. The table with Doors just has IDs (numbers), which DoorTypes has the actual name/type of doors in text format. I need to know how I can make these two tables talk together. Note: I have them linked correctly as far as PK and FK goes(since I exported them with ODBC they already had the relationships established).

There are other tables that will connect with Doors as well, but I'm just using these two to try to get an understand of how to work with relational databases in VB Express.

Any help would be GREAT! Thanks!



Answer this question

databinding trouble (Relational Databases)

  • Duncan Woods

    when databinding the tables, relationships arent created, even if a relationship exists. You would have to create the relationship using the datarelations class:

    http://msdn2.microsoft.com/en-us/library/system.data.datarelation.aspx

    This would apply when you have filled your dataset tables with the data from the tables together, then apply the relation and finally bind it to the bindable UI control for example.

    is this what you maybe after

    edit: http://msdn2.microsoft.com/en-us/library/d6s958d6.aspx



  • NewbieElliott

    A shoot in the dark as I have not done this in VB.Net but in ASP

    Database connection stuff here

    doorid = fieldname

    windowid=fieldname

    end database

    now do another databaseconnection with SQL like "select name from dooridtable where id=doorid"

    now display the name in a textfield like doornametext.text = name

    now do another databaseconnection with SQL like "select windowname from windowidtable where id=windowid"

    now display the name in a textfield like windownametext.text = name

    so what I did was to get all of your ids and set them to a variable, them went through and did a SQL search on each variable and displayed the name in a textbox on your main form.

    Got it I am good on ideas just not on doing sample code, clear as mud, right



  • Brad-RDA

    Yes!


  • Vassilux

    You want to display the name of the field that corisponds to the ID. Right

  • shiveta

    Anyone have any other ideas


  • IvanVC

    I tried that and it gives me an error that a relationship is already established.

    ahmedilyas wrote:

    when databinding the tables, relationships arent created, even if a relationship exists. You would have to create the relationship using the datarelations class:

    http://msdn2.microsoft.com/en-us/library/system.data.datarelation.aspx

    This would apply when you have filled your dataset tables with the data from the tables together, then apply the relation and finally bind it to the bindable UI control for example.

    is this what you maybe after

    edit: http://msdn2.microsoft.com/en-us/library/d6s958d6.aspx



  • databinding trouble (Relational Databases)