Results 1 to 3 of 3

Thread: DataBound grids and textboxes

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Posts
    606

    DataBound grids and textboxes

    Hello everyone.
    I have a question on how to do the opposite of what I seen around the net. IE the Customer/Orders related table thing, where Customers are shown in detail form and their related Orders are shown in a datagridview.

    I have a datagridview that is loaded with clients from a Access db using a tableadaptor and a dataset. Now I want to view there related information in textboxs (Detail form). My problem is that there is something like 100 records in the Client table and 0 in the related project table, so I need to add rows based on the BidID column.

    I'm having a problem wrapping my head around a one-to-many relationship cause 1 client(BidID) should only have 1 related record, so this really even a related record? I've read the one-to-one relationships are rare, cause there handled differently but that was as far as that article went, leaving me with ??????.

    Anyway, does anyone have any advice?
    Life is about making some things happen, not waiting around for something to happen.

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: DataBound grids and textboxes

    Er ... rephrase the question? Not really making a lot of sense at the moment.

    One to one relationships are indeed rare for the simple reason that they're unnecessary. If each primary record only has one set of information then it makes little sense to do anything but combine the information into a single database table in the first place. Otherwise it's relational for relational's sake and little advantage gained.

    There is no difficulty in predetermining what values from a table DGV displays if you manually add columns and define their value members. So it's perfectly feasible to have a subset of columns in the DGV and remaining values in textboxes.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Posts
    606

    Re: DataBound grids and textboxes

    ok I'll try and rephrase.
    I agree that the all the coulmns in the FK table could be included in the PK table for augment sake of the one-to-one relationship, but I do not want to add multiple columns to this table. At most I could add one FK column. Reason why:

    I have another app that uses this database as it's data source. So I do not want to chance any sort of data corruption caused by my app. In fact, all I want to retreive from the PK table in question is client information. Then I'll store all my apps user data into other tables I have made in the same database. So it goes like this.

    Bid table (BidID PK-- original table and used by other app)
    Project Table (ProjectID PK, BidID FK-- new table used to store new apps data)
    there are 78 other tables used by the other app, but these are the 2 in question. And why I have to be very careful.

    So what I want to be able to do is: search through the datagrid, fill some textboxes with related data, based on the row the user is on.

    My problem is when there is'nt a FK in the Projects table.

    So it's almost like I need to check to see if the FK(BidID #) exists in the Project table and if not, then add the row and fill the FK col with the PK from the Bid Table. I thought this was supposed to be automatic, I guessed wrong I suppose.
    Life is about making some things happen, not waiting around for something to happen.

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