473,320 Members | 1,699 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,320 software developers and data experts.

multiple record inserts

Jim
Using aspx and vb with sql2005 server.
I have an insert form/query that will insert a record. What I want to do is
on the page have a dropdown list with numbers. From the dropdown list, the
user will select how many records to insert the date (each insert is a
seperate record).

For example, if a user has 20 parts to enter, instead of entering the same
information 20 times, they can select the number 20 from the dropdown list
and then fillout the information in the form and when the "Insert" button is
clicked, the sql insert query will run 20 times.

Is this possible? If so, can you point me to a place that either has an
example or talks about it?

Thanks.
Jan 18 '08 #1
1 1098


One idea.

Create a strong dataset.

EmployeeDS

with 1 table.

Employee (table)

with some columns

EmployeeID, LastName, FirstName
.............

After your user selects "I want to insert 10 new employees"....
on the code behind, create a "dummy" EmployeeDS, and then bind your GridView
or Repeater to it.
dim ds as EmployeeDS = new EmployeeDS
--excuse any syntax errors with my vb.net skillzz
For i as int32 = 0 to 9

EmployeeDS.EmployeeRow newRow = ds.Employee.NewEmployeeRow

newRow.EmpID = i '' obviously this won't be the actual empid, but
will give you some kind of uniqueidentifier until you ship it to the
database

ds.Employee.AddNewEmployeeRow = newRow

next i

Then bind your GridView to
gv1.DataSource = ds.Employee
gv1.DataBind
That'll give you the entries you need.
THEN!!

You can dual use the EmployeeDS....
http://support.microsoft.com/kb/315968

and insert all 10 new employees into the db in a single shot.

Sweet!


"Jim" <st******@redmond.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Using aspx and vb with sql2005 server.
I have an insert form/query that will insert a record. What I want to do
is on the page have a dropdown list with numbers. From the dropdown list,
the user will select how many records to insert the date (each insert is a
seperate record).

For example, if a user has 20 parts to enter, instead of entering the same
information 20 times, they can select the number 20 from the dropdown list
and then fillout the information in the form and when the "Insert" button
is clicked, the sql insert query will run 20 times.

Is this possible? If so, can you point me to a place that either has an
example or talks about it?

Thanks.

Jan 18 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: RotterdamStudents | last post by:
Hello there, i have a strange problem. I can't get php to insert multiple rows at once in a MySQL database. I use the $sql = "INSERT INTO database (a,b,c,d,e) VALUES ('$a', '$b' ,'$c', '$d',...
3
by: jason | last post by:
How does one loop through the contents of a form complicated by dynamic construction of checkboxes which are assigned a 'model' and 'listingID' to the NAME field on the fly in this syntax:...
1
by: Burton Figg | last post by:
I have a SELECT statement which holds a list of times (for adding appointments to a database): e.g. <select name="time" id="time" size="3" multiple> <option value="00:00">00:00</option>...
10
by: shank | last post by:
I have a recordset that contains multiple records of product a user is purchasing. For clarity, I converted the recordset fields to variables. I need to take that entire recordset and insert it...
1
by: Ryan Hubbard | last post by:
I'm inserting a record into MySQL 4.0 using Visual Basic ADO. When using the AddNew and Update method I am unable to retrieve the value of a Auto incrment field (Yes I know I can MoveLast but this...
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....
0
by: jtocci | last post by:
I'm having a big problem with CREATE RULE...ON INSERT...INSERT INTO...SELECT...FROM...WHERE when I want to INSERT several (20~50) records based on a single INSERT to a view. Either I get a 'too...
1
by: Jerry | last post by:
I am creating an ASP.NET page that does the following: The Page_Load event connects to the database to populate a dropdown list. The Button_Click event connects to the database to check if the...
1
by: Magnus | last post by:
I'm testing walkthrough saving data to a Database (Multiple Tables). http://msdn2.microsoft.com/en-us/library/4esb49b4(VS.80).aspx In the famous Customer/Order example, I'm getting referential...
58
by: bonneylake | last post by:
Hey Everyone, Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple fields for the not only the serial section but also...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.