Click here to Skip to main content
16,019,018 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone,

I have a stored procedure:

SQL
create procedure sp_proc1 @obj_code
as begin select * from employee where @obj_code=obj_code


It returns several records. I want this with Linq in my Windows application to put these records in a data table:

C#
testDatacontext db=new testDatacontext();
var results=db.sp_proc1(melk_id);
for each(sp_proc1result result  in result)
{
  //??????????????????????????????
}


How can I put the retrieved data in a data table?
Posted
Updated 24-Aug-10 7:46am
v3

1 solution

I'm guessing here, based on what I remember from some LINQ To SQL training I viewed last week....

I think you could create a DataAdapter that does a "select * from results" and use its Fill(table) method to populate the table. It seems to me that LINQ should be able to handle that, although I don't know how much of the new table's design you would have to specify first. Those who are more versed in this can provide the implementation details that aren't yet in my fast-access memory. (I'd really like to know if I got this right :cool:.)
 
Share this answer
 
v2

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