使用LINQ to SQL的存储过程 [英] Stored Procedures using LINQ to SQL

查看:95
本文介绍了使用LINQ to SQL的存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!我想在我的item_master表中选择电影的物品代码,并将其传递给存储过程.我对此做了一些编码,剩下的我不知道该怎么做.你们可以帮忙吗?这是我的代码,不要指向其他教程.请直接在此处发布代码.

hi!, i wanna select the item code of movie in my item_master table and pass that in to a Stored Procedure. i did some coding on that and i dont know how to do the rest. can you guys help?? this is my code, and don''t point me to another tutorial. please just post the code right here..

public bool GetBookData(String mail, String MovieName)
    {
        String movie = MovieName;
        String email = mail;

        MoviesGenDataContext con = new MoviesGenDataContext();

        var itemcode = from code in con.Item_Masters
                       where code.Name == movie
                       select code;

        var insertAdBdetails = con.addAdvanceDetail(); //this accepts an integer

推荐答案

这应该获得代码:
This should get the code:
int code = itemcode.FirstOrDefault();


您必须致电该函数映射到MoviesGenDataContext中的存储过程.像这样--------------

con.YOUR_STOREPROCEDUR_NAME(parameters);

就是这样.
You have to call the function mapped to store procedure in your MoviesGenDataContext. Like this--------------

con.YOUR_STOREPROCEDUR_NAME(parameters);

That is all.


这篇关于使用LINQ to SQL的存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆