ASP.NET w/ Sql Server 2000
-
I'm having some problems trying to use one insert statement to load multiple records into the database, Sql Server 2000. The data is captured from a web form, but I don't want to use multipe insert statements for 25 data strings. I know Sql Server has Insert/Select or Insert/Exec, but this copy one table to another. Any recommendations would be appreciated!
-
I'm having some problems trying to use one insert statement to load multiple records into the database, Sql Server 2000. The data is captured from a web form, but I don't want to use multipe insert statements for 25 data strings. I know Sql Server has Insert/Select or Insert/Exec, but this copy one table to another. Any recommendations would be appreciated!
Hey there, I would recommend using stored procedures as they would be ideal for your situation lets take the following example: Sign Up Form: 2 Tables 1- Users 2- UserInfo You would like to insert data into Users and then take the Unique ID generated and insert that into UserInfo. The traditional method is to : INSERT INTO........ twice Using a stored procedure is like storing the method on the server. From your code you call the stored procedure and simply pass it the parameters which it requires. http://webdevelopment.developersnetwork.com/Articles.asp?Article=223[^] This is an OK exmaple/tutorual on stored procedures but if you can invest i highly reccomend: http://www.amazon.co.uk/exec/obidos/ASIN/1861007418/qid%3D/026-3028095-7898815[^] Which is brilliant to get your knowledge upto scratch, it includes a very useful chapter purely on stored procedures.