How To ExecuteThe StoreProcedure

2 posts, 1 answers
  1. Majid
    Majid avatar
    9 posts
    Member since:
    Dec 2008

    Posted 06 Dec 2008 Link to this post

    How can i execute the store procedure wirtten in SQL Express 2005. Actualy what class should i use to run the store procedure?

    Thanks.
  2. Answer
    Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 08 Dec 2008 Link to this post

    Hi Majid,

    as OpenAccess does not generate a SP-specific proxy you will need to use IObjectScope.GetSqlQuery(string,Type,string) to call a stored procedure.

    Example:

    IQuery q = scope.GetSqlQuery("foobar ?, ?",null,"INTEGER i, FLOAT f");
    IQueryResult r = q.Execute(new object[] { 42, 0.1234f });
    r.GetEnumerator(); // triggers the execution!

    This would execute the foobar SP with the integer parameter 42 and the float parameter 0.1234.
    The result would be discarded.

    Please see the reference guide on the GetSqlQuery method too.
    Best wishes,
    Thomas
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. DevCraft banner
Back to Top