Results 1 to 4 of 4

Thread: Dataset to an array? PLUS MORE!

  1. #1

    Thread Starter
    Member red_bull_n_vodka's Avatar
    Join Date
    Jun 2005
    Posts
    32

    Dataset to an array? PLUS MORE!

    Next problem:

    VB.NET application, Access w/ SQL statements

    I have a "Select GAS_SERV" on a parent table that joins with a child table and confirms that 2 fields are the same (along with some other parameters) and the deletes the row per the GAS_SERV number from the parent table. (Im just learning how to do all of this so bare with me) I did that as practice and I have that down. What needs to happen is the 11 child tables that have that that GAS_SERV number needs their rows deleted also.

    If I delete the rows from the children first, I wont have the fields that I checked the parent against to delete the rows from the parent table. (I am confused too)

    What I think I could do is have a select statement that would get the GAS_SERV numbers I need to fill a dataset, get those numbers into an array, then loop those numbers through a delete statement, I think that would solve my problem.

    First question: Did that make any sense at all? Second: What would you do if you understand my problem? Third: How do I get the dataset records into an array (if thats a good idea)?

    Thanks again.
    I am a rookie @ this...

  2. #2
    Hyperactive Member
    Join Date
    Jul 2005
    Location
    In A House :)
    Posts
    291

    Re: Dataset to an array? PLUS MORE!

    first off, what DB are you using.

    second, is your diagram hooked up that way (1-many) against all 11 child tables (and why on earth would a dba do that...hmmm....)

    if your diagram is hooked up that way, deleting the parent record should delete the child records, if and only if you have referential integrety (sp, it's late, i'm tired) cascade delete on the db.

    and your dts is already a array...why mess with it

  3. #3

    Thread Starter
    Member red_bull_n_vodka's Avatar
    Join Date
    Jun 2005
    Posts
    32

    Re: Dataset to an array? PLUS MORE!

    Quote Originally Posted by DirtyHowi
    first off, what DB are you using.

    second, is your diagram hooked up that way (1-many) against all 11 child tables (and why on earth would a dba do that...hmmm....)

    if your diagram is hooked up that way, deleting the parent record should delete the child records, if and only if you have referential integrety (sp, it's late, i'm tired) cascade delete on the db.

    and your dts is already a array...why mess with it
    It is an Access database that I am testing myself on. I have a week and a half to get this down, convert it SQL version so the program can run on the SQL Server database before July 29th.

    They are not hooked up with referential integrity. The parent has GAS_SERV numbers that the children do not, and the children have multiple GAS_SERV instances per number.

    I can loop though the dts? Im going to give that a shot.

    Thanks
    I am a rookie @ this...

  4. #4
    Hyperactive Member
    Join Date
    Jul 2005
    Location
    In A House :)
    Posts
    291

    Re: Dataset to an array? PLUS MORE!

    you can hook the tables up as long as GAS_SERV is the same data type, set the GAS_SERV field to primary key, then just drag and drop on each of the other tables in teh db view.

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