Is it possible to add parameter using list in c# to pass that parameters to a store procedure.
when we want to add parameter to store procedure we write a code
cmd. parameter .add ("@variablename",Value of that variable)
but i have a table and in that table i have 5 columns and i have written a stored procedure for inserting value in a table.
when i add the value with the help of C# code as just i define above[cmd. parameter .add ("@variablename",Value of that variable)]
But My ques is that i do not want to add variable name in my cmd. parameter .add ("Here i want to declare something as a index no. which identify what value inserted in appropriate column",Value of that variable)
Can it possible in c# code
thanks in advance........................
mohit guptaPosted Feb 6, 2014, 6:36 AM
Jaganathan BantheswaranPosted Feb 6, 2014, 6:26 AM
There is no way to execute a SP without specifying parameter name if the SP has parameters.
But there is another way you can try. You can send a DataTable to SP.
http://msdn.microsoft.com/en-us/library/bb675163%28v=vs.110%29.aspx
http://www.mssqltips.com/sqlservertip/2112/table-value-parameters-in-sql-server-2008-and-net-c/