Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

1 solution

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
 
Share this answer
 
Comments
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900