1

I had applicant project with multiple pages as the user will go through these pages to complete his applicant data then at the last page he will find submit the data.

My problem is that, I have multiple tables and when the user submit his data the data will inserted into it's table , so how can I create one stored for all these table .

1
  • make a procedure in sql server that will get data and save it to tables of your desire. Commented Dec 11, 2012 at 10:12

2 Answers 2

1

If you want to insert/update several tables at once, you would be better off using a stored procedure. Create/Read/Update/Delete (CRUD) stored procedure are generally good practice and reduce the risk of SQL injection attacks.

Here's what your Create (insert) stored procedure might look like (it's incomplete and unnormalized):

CREATE PROCEDURE [dbo].[ApplicantIns]
(   
    @Name   nvarchar(50)
    ,@Skill nvarchar(5)
    ,@Age   int
    ,@comment nvarchar(50)
)
AS
    SET NOCOUNT ON;

    INSERT INTO [dbo].[Applicant]([name]) VALUES(@Name);

    INSERT INTO [dbo].[Skillset]([Skill], [Comment]) VALUES(@Skill,@Comment);

    INSERT INTO [dbo].[Statistics]([Age]) VALUES (@Age);

You could then call this stored procedure when someone submits a new application.

Sign up to request clarification or add additional context in comments.

Comments

1

Are you using .NET Framework? If so, what version?

In case you're using .NET > 3.5 + MS SQL 2008 you can use table valued parameters

1 Comment

I used .net 3.5 and sql server2005

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.