Results 1 to 3 of 3

Thread: [Solved] VB 2005 using datasets/binding with a 3NF DB

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2005
    Location
    Missouri
    Posts
    69

    [Solved] VB 2005 using datasets/binding with a 3NF DB

    Hey guys, I was hoping someone here might be able to shed some light on a problem I was having interacting with my database, using Visual Basic - VS 2005.

    The very nature of the DB I'm working with is that the data I need is spread around a large number of tables, so in order to retrieve the correct piece I'm often joining 2 or more tables and passing variables to my query from VB.

    Now, I've just recently started using the built in features of TableAdapters, DataSets and BindingSources. Prior to this, I would import the SQLClient and simply send all my queries to the database directly.

    What I'd like to do is cut down on the number of datasets I need to work with on a single form, as they're getting out of hand. For example, on one form, I'm using 7 datasets, 10 Binding sources, and 10 Table adapters.

    Now that I've given you a horrendeous amount of background: Is there a way for me to run queries against a dataset in the same way that I would run them against a SQL database?

    So far, I've tried using the .filter method of the binding source and the .select method of the dataset.table objects, however neither of these allow me to do joins.

    An example scenario would be:
    DataSet1 contains TableA and TableB.
    TableA contains the ID and Name of some data.
    TableB contains link data: CurrentID, LinkID

    So, for example, if your CurrentID was 5 it may have entries with a LinkID of 6, 7, and 8.

    How do I query TableB to get the LinkIDs and then extract the corresponding Name entries (for ID 6, 7, and 8) without renewing the DataSet against the Database with a TableAdapter Fill method?

    The reason I don't want to renew it, is that I'm using the data elsewhere at the same time. It just seemed to me that I should be able to bind multiple controls to the same table in a dataset, and have each of them display a different query against that information.

    I'm sure that doesn't make a lot of sense, but as I said, I'm used to sending queries to the database itself. So, if anyone has managed to read through this without getting a headache, I could use some advice, even if that advice is to go back to using direct SQL queries against the DB.
    Last edited by Surveillance; Dec 8th, 2008 at 04:19 PM. Reason: Problem Solved

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