Dynamic creation of MySQL stored procedure

Thread is closed for posting
2 posts, 0 answers
  1. Jouie
    Jouie avatar
    9 posts
    Member since:
    Nov 2007

    Posted 16 Jul 2009 Link to this post


    I'm trying to run the code (test code only) below but unfortunately it did not create a stored proc in mysql.


    StringBuilder createSQL = new StringBuilder();
    createSQL.AppendLine(string.Format("CREATE PROCEDURE `test_GetTestData_ID{0}`", test.TestId));  
    createSQL.AppendLine("\tSELECT * FROM Test;");  
    scope.GetSqlQuery(createSQL.ToString(), null, null);

    Is OpenAccess supports the creation of a mysql stored proc and any workaround in this problem?







  2. Ady
    Ady avatar
    589 posts

    Posted 17 Jul 2009 Link to this post

    Hello Jouie,

     OpenAccess does not execute the query immediately in order to avoid loading the complete result set. The query is executed when you iterate over the result.
    In order to execute the query you should do the following
    1. Obtain the query instance - IQuery query = scope.GetSqlQuery(createSQL.ToString(), null, null);
    2. Execute the query - IQueryResult res = query.Execute();
    3. Call res.Count. This will actually execute the query.

    Sincerely yours,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top