Insert into Access DB an object list RRS feed

  • Question

  • User281366132 posted

    I have a list of objects stored in a session (Session("CC")), I work in VB code, and I need to insert that code into a table.

    And I have another Session("UtilizatorLogat") in witch I have stored The user's data in an object, that has: "Tip" (type), "ID", "User".

    I need to add firsly in the Facturi_vanzare the Tip Client and depending on the type (if it's "PF" add the ID into CNP / if it's "PJ" add into the CUI), the Primary key is autonumber And the curent date into "DataFacturaVanzare". And after that, retrive the Primary Key, And... insert into the second table that has that primary key as foreign key, all the objects/"Produs" stored in the firs session

    Here is a picture of the 2 tables so you can understand better what I am saying:

    So, tu recap:

    1) I need to add into the table "Facturi_Vanzare" from the object stored in the session "UtilizatorLogat"

    • into "TipClient" the Tip from the object
    • if Tip is "PF" add ID into CNP
    • if TIP is "PJ" add ID into CUI
    • Add the curent date in format: dd.mm.yyyy

    2) Retrive the PrimaryKey "NrFacturaVanzare"

    3) Insert Into "ProduseFacturateVandute"

    • The Primary key we just retrived
    • For each object in the list stored in Session("CC") the CodProdus into CodProdus
    • For each object in the list stored in Session("CC") the Cantitate into CantitateProdusVandut

    So everything in VB code... and not with ADO.NET because I understood ADO.NET doesen't work with x64 systems...

    From what I searched... you must connect with an ole db or something...

    Please help me, it's for my graduation project... It gets complicated by the minute, I hope this is the last problem I have to face...

    Friday, July 6, 2012 4:26 AM


  • User281366132 posted

    My question was how can I add thoes lines, retrive the last added from another table and insert from vb code, depending on the type of one row...

    I belive thoes links can help me, I'll test them tomorrow, because now it's 2am (02:00) here and I kinda stopped thinking half an hour ago:D (if the links are good I'll mark as solved the topic)

    Thank you for responding!

    I found the answer, nevermind :)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 6, 2012 6:52 PM

All replies