This is a migrated thread and some comments may be shown as answers.

Dynamic creation of MySQL stored procedure

1 Answer 60 Views
Databases and Data Types
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jouie
Top achievements
Rank 1
Jouie asked on 16 Jul 2009, 11:56 AM
Hi,

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("BEGIN");  
createSQL.AppendLine("\tSELECT * FROM Test;");  
createSQL.AppendLine("END;");  
scope.GetSqlQuery(createSQL.ToString(), null, null);

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


Cheers,
Jouie

 

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Ady
Telerik team
answered on 17 Jul 2009, 02:24 PM
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,
Ady
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.
Tags
Databases and Data Types
Asked by
Jouie
Top achievements
Rank 1
Answers by
Ady
Telerik team
Share this question
or