Current location: Hot Scripts Forums » Programming Languages » ASP.NET » Inserting multiple records in one form


Inserting multiple records in one form

Reply
  #1 (permalink)  
Old 09-15-04, 07:38 AM
andreasberglind andreasberglind is offline
Newbie Coder
 
Join Date: Jul 2003
Location: Sweden
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Inserting multiple records in one form

I need to insert more than one record into a SQL database at the same time.
I want to be able to create a list out of two sources on the page.

The first is Name, which is loaded from an SQL table into a Datagrid at PageLoad.

The second is Nickname which is entered in a Textbox. When a name is selected and a nick is entered I guess I need to load those values into a couple of arrays, as itīs all going into the database (Well, NameID and Nickname is going into the Nickname table).

I need to know how to create this list of up to 15 nicks and display them on the page. Does anyone have any ideas??
Thanks
Reply With Quote
  #2 (permalink)  
Old 10-19-04, 11:46 PM
thuenb thuenb is offline
Newbie Coder
 
Join Date: Oct 2004
Location: MI
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
You can do this using stored procedures if you are working in a SQL server box.

Below is a snippet from a stored sql database procedure that I have created to insert new picture names into a database. Just replace your variables with the variables you need. You may need to do some reading on stored procedures to get this to work with your page, because you will need to know how to call and pass your variables to the stored procedure.

Code:
CREATE PROCEDURE DatabaseName.DInsertProductPics

	(
		@ProductID numeric,
		@PicID numeric,
		@PicName nvarchar(150) = null
	)

AS
SET NOCOUNT ON
Insert into DataTableName(ProductID, PicID, PicName) Values(@ProductID, @PicID, @PicName)
Insert into DateTableName2(ProductID, PicID, PicName) Values(@ProductID, @PicID, @PicName)
RETURN
Hope this helps...
__________________
Best Regards,
Brian Thuen
http://www.AdvisedSolutions.com
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with updating a multiple checkbox form to a MySQL DB jimb575 PHP 1 01-31-06 08:04 PM
Send form results to multiple databases stomlin PHP 3 08-18-04 12:14 PM
transfer multiple value of a form field to another field ore JavaScript 2 06-18-04 08:50 PM
stuck on updating multiple records us0r PHP 6 05-20-04 11:19 PM
Post form to multiple scripts epetoke Script Requests 1 05-14-04 03:25 PM


All times are GMT -5. The time now is 12:54 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.