LinQ To SQL For Stored Procedures

Stimulsoft Reports.NET discussion
Post Reply
galawij
Posts: 16
Joined: Sat Feb 11, 2012 4:37 am
Location: U.S

LinQ To SQL For Stored Procedures

Post 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.
galawij
Posts: 16
Joined: Sat Feb 11, 2012 4:37 am
Location: U.S

LinQ To SQL For Stored Procedures

Post by galawij »

is it possible?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

LinQ To SQL For Stored Procedures

Post by Alex K. »

Hello,

Please see the sample in attachment.

Thank you.
Attachments
1666.LinqToSql.Net.zip
(24.95 KiB) Downloaded 235 times
galawij
Posts: 16
Joined: Sat Feb 11, 2012 4:37 am
Location: U.S

LinQ To SQL For Stored Procedures

Post 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?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

LinQ To SQL For Stored Procedures

Post 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.
Attachments
1684.LinqToSql(with StoredProc).Net.zip
(25.45 KiB) Downloaded 254 times
Post Reply