Results 1 to 8 of 8

Thread: Adding multing rows at the same time.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Pakistan
    Posts
    80

    Wink Adding multing rows at the same time.

    Hi

    wht is the best way to add multiple rows in a table at the same time.
    example.


    i have a table name empinfo which contain

    empid empname designation.


    now i want to add record like this


    1 ANN SUPPLIER
    2 David Supervisor
    3 Kami Manager
    4 Mark Store Incharge.


    when i click add button all the data add atonce in the table.


    Than you all in due anticipation



    Adeel Ahmed

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Pakistan
    Posts
    80
    friends

    i need a little hint

    plz help.



    Adeel Ahmed

  3. #3
    Lively Member Maartin's Avatar
    Join Date
    Jan 2000
    Location
    Benoni, Gauteng, South-Africa
    Posts
    99
    adeelahmed

    What grid are you refering to ? in VB in asp ? the possible answer depends on the answer to these questions.

    Maartin
    Have Fun ;-)
    Maartin
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    if it ain't broke don't fix, rewrite it.
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Pakistan
    Posts
    80
    i'm using asp.

    not using any active x component.

    just simple form. which has

    id text name text designation text

    in say 4 rows

    and when i submit the form

    all the data should add atonce into the table.


    can it happen using some loops or array?
    or
    tell me if i got to use any active x component.

    a simple form is attached.
    Attached Files Attached Files



    Adeel Ahmed

  5. #5
    Lively Member Maartin's Avatar
    Join Date
    Jan 2000
    Location
    Benoni, Gauteng, South-Africa
    Posts
    99
    Hi Adeel.

    It can be done but you will have to use a loop of sorts.
    This is all off the top of my head.

    Give me some time over the weekend and I can do a sample for you.
    But what you will have to do is use read the info into variables (which can be a array) then you start a loop and issue 'INSERT' statements to the database.
    This will be very quick.

    I have it on my intranet site, but is only with one record but from
    the time the user clicks Update till the page load again in only
    1 sec. Added this is only over the network.

    But give me some time and I will have something for you.
    Have Fun ;-)
    Maartin
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    if it ain't broke don't fix, rewrite it.
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

  6. #6
    Lively Member Maartin's Avatar
    Join Date
    Jan 2000
    Location
    Benoni, Gauteng, South-Africa
    Posts
    99
    Hi Adeel,

    Here is a zip file with your file and the file to read the results.

    Cheers.
    Attached Files Attached Files
    Have Fun ;-)
    Maartin
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    if it ain't broke don't fix, rewrite it.
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Pakistan
    Posts
    80
    Thanks Maartin

    Thank you very much

    Your code seems to work well

    but it has restrict that

    when ever i will insert data certain rows must effect evrey time.

    which i don't want

    cuz some time i just want to add only one record row.



    i think you can get this

    i will be more than happy if you want more explanation.



    Adeel Ahmed

  8. #8
    Lively Member Maartin's Avatar
    Join Date
    Jan 2000
    Location
    Benoni, Gauteng, South-Africa
    Posts
    99
    Hi Adeel,

    Correct me if I'm wrong but from what I understand is that you want to insert and or update, the record depending on if the records exist in the database?

    If this is the case there are various way of doing it.
    The best one is that when you load the first page with all the textboxes you must load the data.

    This means that the user(s) can edit the data, this also means that you have to create a hidden textbox on the first page with and unique value to the record. The user(s) can then edit the text, when the user(s) clicks on the update button you will have to put a check in the 'save' page that checks if the hidden field has a value you must do an update else you must do an insert.

    The ext way to do it is to query the database on the 'save' page and check if the record does exist with the info from the previous page. If it does do an update else do an insert.

    Hope this helps you.
    Have Fun ;-)
    Maartin
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    if it ain't broke don't fix, rewrite it.
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

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