473,386 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

insert multiple records into access database-how?

35
hi, im somehow new to web development,
im developing an application with ms access 2003 using asp
i want to know if there's a way to make a bulk insert into the database
using the recordset object.
im trying to use the updatebatch method by im still not able to perform(i dont know if it's the right 1 to use)

in my database i use an autonumber field type as my PK
if there's a chance that 2 users would be inserting data as the same time
would that make a problem in the database, and if so how can i deal with it.

So if somebody could provide me with a little code example , it would be awsome

Thank You
Jul 31 '06 #1
5 16443
hi

u can use this code of auto number creations ok
ers.open "select max(val(id)) from empid",db,0,1

if isNull(ers(0))=true then
else
wid=ers(0)+1
response.Write(wid)
end if

and i dont know correctly ur problem of "insert multiple records into access database" please explain clearly
Aug 1 '06 #2
r_o
35
hi,
im talking about inserting them at once like a batch or bulk
regarding the autonumber, i've set it to auto increment so it increments alone
but i dont know if that could be dangerous on the web.
another question please:
how after inserting just one record to the database can i get the value of the autonumber inserted ( i want to retrieve it among other fields withou having to make 2 accesses to the database) itries
"select * from beneficiary where beneficiary_code=(select max(beneficiary_code) from beneficiary)" right after the insert operation but iot returned an error!!!
is there a solution for that
or maybe there's a beter way?
Aug 1 '06 #3
hi

why dont you get the last inserted id using theSQl last@@Identity.
Aug 2 '06 #4
Hi

ers.open "select max(beneficiary_code) from beneficiary",db,0,1

if isNull(ers(0))=true then
else
wid=ers(0)+1
response.Write(wid)
end if

Now u get a ID u can store that in one column of database like autonumber beneficiary_Id. like that.

what error msg u got inserting multiple records in Database please..
Aug 2 '06 #5
r_o
35
ok i have a question about this @@IDENTITY query

if 2 users were inserting data at the same time,there would be 2 ADO connection created 1 for each right.

so this query (select @@IDENTITY as id) does it retrieve the last id inserted by the user issuing the call to the query ie. for the ADO connection specific to that user
or does it include values inserted by the other one as well?

if it doesn't my problem is solved but if it does, then i would need to insert multiple records into one table at once with one access to the database,
if there's a way to do that i wish someone could pass it to me please

Thank You
Aug 2 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Jack | last post by:
I have a text file of data in a file (add2db.txt) where the entries are already entered on separate lines in the following form: INSERT INTO `reviews` VALUES("", "Tony's", "Lunch", "Great...
2
by: Joe | last post by:
Hey, I'm going to give some background on my situation in case anyone can point out a way around my problem altogether... for the problem itself, please skip to the bottom of the post. thanks....
1
by: Charlie | last post by:
Hello, I have data in an Access table that I would like to export to multiple HTML tables. I would like to split the data in the Access table (about 92,000 records) into multiple HTML...
0
by: htmlgeek | last post by:
I'm adding and updating records in an Access .mdb via WWW .asp page. Authored in Dreamweaver 2004 MX. Help is welcome on this one. I have a great set of pages that work fine, but it seems that...
3
by: Andrew Bourne | last post by:
I would like to insert multiple records into a table based on a query returned from the same table. For example a datareader returns 3 records containing the following records user1 file1...
4
by: Mike Hnatt | last post by:
My goal is to get data from an XML file into a couple of tables in an Access database. The XML file is a little complex so I need control over what I do (I can't just read it into a dataset). ...
2
by: r_o | last post by:
hi i'm new to this issue i'm developping a web application with an access database in my application there's a loop that gets values of a form like: lastElt=request("numberOfItems") for...
21
by: lesperancer | last post by:
I've got an access97 reporting mdb that pulls data (77,000 rows) from a sql server table into a local table to run reports if the local table is part of the reporting MDB, the insert statement...
10
by: MLH | last post by:
Suppose, in a multi-user environment, you have append query SQL in a VBA procedure that looks like INSERT INTO MyTable... and the next line reads MyVar=DMax("","MyTable... You can never be...
0
chumlyumly
by: chumlyumly | last post by:
Hello scripters - OS: Mac OSX Language: PHP w/ MySQL database I've created an insert page where a user inputs his info, which then goes to four different tables in a MySQL database. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.