Click to See Complete Forum and Search --> : Adding multing rows at the same time.
adeelahmed
May 30th, 2001, 08:18 AM
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
adeelahmed
Jun 1st, 2001, 01:27 AM
friends
i need a little hint
plz help.
Maartin
Jun 1st, 2001, 04:04 AM
adeelahmed
What grid are you refering to ? in VB in asp ? the possible answer depends on the answer to these questions.
Maartin
adeelahmed
Jun 1st, 2001, 07:08 AM
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.
Maartin
Jun 1st, 2001, 08:17 AM
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.;)
Maartin
Jun 4th, 2001, 12:53 AM
Hi Adeel,
Here is a zip file with your file and the file to read the results.
Cheers.
adeelahmed
Jun 7th, 2001, 12:38 AM
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.
Maartin
Jun 7th, 2001, 02:20 AM
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.
:D 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.
:rolleyes: 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.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.