开发者

Connecting a web APP using LINQ to a database and passing values to a stored procedure

开发者 https://www.devze.com 2023-04-01 19:25 出处:网络
For a while i have been googling how to use LINQ 开发者_StackOverflow社区and connecting my stored procedures in c#. Anyone out there can give me some form of hint or some sort of help? That would be g

For a while i have been googling how to use LINQ 开发者_StackOverflow社区and connecting my stored procedures in c#. Anyone out there can give me some form of hint or some sort of help? That would be greatly appreciated.


You can have the Visual Studio / DBML designer scaffold the stored procedure for you and generate the required code to call it, with strongly typed parameters. Just drag the required stored procedure within the DBML designer:

  • dragging it within an existing entity will make your stored procedure returns a collection of instances of that type, if possible;
  • dragging it to the Stored procedures panel will make it returns a collection of rows specific to that stored procedure.


Easiest way is to use a Linq-to-Sql layer or .dbml. Scott Guthrie has a great series of blog posts on setting this up. Start here: http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消