Click here to Skip to main content
11,923,046 members (61,502 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET XML SQL
Dear Friends,

I want insert a record in a table.
Where as, the column are more then 20.
So now i am passing all the values a different parameter in C# method and passing in Stored Procedure.
Can any one guide or suggest any better option for the same.
Posted 8-Oct-12 2:38am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

There is no such better option what you are currently doing.

But there are several options each have their own pros and cons and it depends on the application requirement which one to use.

Other options, what I remember now are,
1. Pass a xml string to sp. XML string will contain all the values. This is useful when you are doing bulk insert. SQL Server has inbuilt function to read xml string or you can use xquery to query xml within sp.
2. You can use SqlCommandBuilder Insert command to insert the record

But still, I see for normal scenario, what your doing now is the best (whatever the number of columns you have)

Arunprasath Natarajan 8-Oct-12 10:05am
Thank You for explaining well.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.151125.3 | Last Updated 8 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100