By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,267 Members | 1,808 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,267 IT Pros & Developers. It's quick & easy.

Adding Records

P: n/a
Hi everyone, here's what id like to do.

I have a table with 2 fields, name and value

I need to be able to add multiple records quickly, for example I need to add

name value
abc 1
abc 2
abc 3
abc 4
abc 5
abc 6

etc etc, does each record have to be added separately, or is there a way I
can add a chosen number of records, lets say 10, and have the value field
increase by one each time?

sometimes I might have 30+ simple records that need adding quickly, and each
time the first records value will be one, and each record after will
increase by one, is there a way to solve this problem or does each record
have to be added separately?

Thanks

Jamie

Jul 19 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Jamie Fryatt wrote on 06 feb 2004 in
microsoft.public.inetserver.asp.general:
Hi everyone, here's what id like to do.

I have a table with 2 fields, name and value

I need to be able to add multiple records quickly, for example I need
to add

name value
abc 1
abc 2
abc 3
abc 4
abc 5
abc 6

etc etc, does each record have to be added separately, or is there a
way I can add a chosen number of records, lets say 10, and have the
value field increase by one each time?

sometimes I might have 30+ simple records that need adding quickly,
and each time the first records value will be one, and each record
after will increase by one, is there a way to solve this problem or
does each record have to be added separately?


Are you talking databases, or html tables, or ASP arrays?

Is "adding" adding new records, or adding values of fields?

If I surmize correctly, ASP + HTML table + new records adding:

<table>
<%
for n=1 to 100
t = "<tr><td>abc</td><td>" & n & "</td></tr>"
document.write t
next
%>
</table>

not tested

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #2

P: n/a
Evertjan. wrote on 06 feb 2004 in microsoft.public.inetserver.asp.general:
<table>
<%
for n=1 to 100
t = "<tr><td>abc</td><td>" & n & "</td></tr>"
document.write t
next
%>
</table>

not tested


response.write

so much for not testing ;-{

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #3

P: n/a
i am talking about adding records to an access db, using asp.

i need a user to be able to select a number of records to add , ie 20 click
go and a script somehow adds 20 records to the access db, but the value
field must increase by one each time one of the 20 records is added.

hope that makes snese
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
Evertjan. wrote on 06 feb 2004 in microsoft.public.inetserver.asp.general:
<table>
<%
for n=1 to 100
t = "<tr><td>abc</td><td>" & n & "</td></tr>"
document.write t
next
%>
</table>

not tested


response.write

so much for not testing ;-{

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Jul 19 '05 #4

P: n/a
Jamie Fryatt wrote on 06 feb 2004 in
microsoft.public.inetserver.asp.general:
i am talking about adding records to an access db, using asp.

i need a user to be able to select a number of records to add , ie 20
click go and a script somehow adds 20 records to the access db, but
the value field must increase by one each time one of the 20 records
is added.

hope that makes snese


Oh yes it does, [though we are out of snese over here at present]

<%
'' open the database

a = 123

for n=a ot a+19
sql="INSERT INTO MyTable VALUES ('abc', " & n & ")"
CONNECTION.Execute(SQL)
next
%>

It would be better to use an autoincrement field
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #5

P: n/a
Jamie Fryatt wrote:
i am talking about adding records to an access db, using asp.

i need a user to be able to select a number of records to add , ie 20
click go and a script somehow adds 20 records to the access db, but
the value field must increase by one each time one of the 20 records
is added.

For real efficiency, make the [value] field an autonumber field (per
Evertjan's suggestion), and then create a table called Numbers containing a
single field called Limit in your database and add 20 (or however many
records you intend the user to be able to add at a single shot) records to
the table, like this:

1
2
3
4
5
6
....
20

Then create a saved parameter query in Access called qAddXrecords, with the
following SQL :

Insert Into tblName (name)
Select [pName] FROM Numbers
WHERE [limit] <= [pLimit]

Test the query by running it. Access will prompt you for the values for the
parameters. Once you have verified that it works, save the query, then, in
ASP, do this:

'open a connection, using a variable called "cn", then:
cn.qAddXrecords "abc",20

HTH,
Bob Barrows

PS. "name" and "value" are reserved keywords and should not be used for
object names in your database. See here for the list of words to avoid:
http://www.aspfaq.com/show.asp?id=2080
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #6

P: n/a
Bob Barrows wrote on 06 feb 2004 in
microsoft.public.inetserver.asp.general:
PS. "name" and "value" are reserved keywords and should not be used for
object names in your database. See here for the list of words to avoid:


The good thing about programming in another language than English is that
we nearly never encounter such mistakes.

We, overhere, would call the fields "naam and "waarde".

;-}

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.