Click here to Skip to main content
11,431,829 members (61,977 online)
Rate this: bad
good
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
good
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)

cheers
  Permalink  
Comments
Arunprasath Natarajan at 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)



Advertise | Privacy | Mobile
Web03 | 2.8.150428.2 | 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