Page 1 of 1

LinQ To SQL For Stored Procedures

Posted: Wed Feb 22, 2012 4:41 am
by galawij
Hello,
How Can I call a stored procedure?
For Table it works,but for Sp it has a error...
Does it supported in 2011.3?
Thank you.

LinQ To SQL For Stored Procedures

Posted: Wed Feb 22, 2012 3:17 pm
by galawij
is it possible?

LinQ To SQL For Stored Procedures

Posted: Thu Feb 23, 2012 8:16 am
by Alex K.
Hello,

Please see the sample in attachment.

Thank you.

LinQ To SQL For Stored Procedures

Posted: Sat Feb 25, 2012 1:09 am
by galawij
Hello.
Thanks Aleksey,
For Table It Works,but It does not work for Stored Procedures.
I Use This code for Web:

Code: Select all

String AppDirectory = HttpContext.Current.Server.MapPath(String.Empty);
using (ReportDataContext db = new ReportDataContext())
         {
             IEnumerable categories = db.SPOneData(2);
             StiReport report = new StiReport();
             report.Load(AppDirectory + "\\Report.mrt");
             report.RegData("Categories", categories);
             StiWebViewer1.Report = report;
         }
is It Possible To call a Stored Procedures with LINQ?

LinQ To SQL For Stored Procedures

Posted: Mon Feb 27, 2012 2:45 am
by Alex K.
Hello,

You can use the following code:

Code: Select all

            using (NorthwindDataContext context = new NorthwindDataContext())
            {
                ISingleResult result =
                    context.SalesByCategory("Beverages", "");
                
                report.RegData("SalesByCategory", result.ToList());
            }
Please check the sample in attachment.

Thank you.