tag:blogger.com,1999:blog-7352323701912967109.post1868667869211862028..comments2022-04-06T19:54:35.904-07:00Comments on Mark Cordell's blog: Calling MySQL stored procedures from C# with Connector/NetUnknownnoreply@blogger.comBlogger7125tag:blogger.com,1999:blog-7352323701912967109.post-68606710189415447692015-10-07T07:30:12.064-07:002015-10-07T07:30:12.064-07:00Heya, thanks a TON for making this blog post! I r...Heya, thanks a TON for making this blog post! I recently took a job developing for a company that uses MySQL a lot, and my history is almost totally SQL Server. This saved me a ton of research.<br /><br />Thanks Again!<br />Joshua AustillHawstel Awstelhttps://www.blogger.com/profile/02103185001315102104noreply@blogger.comtag:blogger.com,1999:blog-7352323701912967109.post-29690407914779372652014-06-26T18:01:40.357-07:002014-06-26T18:01:40.357-07:00Solution: In the Connection String set parameter &...Solution: In the Connection String set parameter "UseProcedureBodies=false".<br />No more problem!chimarraohttps://www.blogger.com/profile/00555928231791704033noreply@blogger.comtag:blogger.com,1999:blog-7352323701912967109.post-67039870958244965742013-07-04T13:31:17.626-07:002013-07-04T13:31:17.626-07:00if (my_con.State == System.Data.ConnectionState.Op...if (my_con.State == System.Data.ConnectionState.Open)<br /> {<br /> try<br /> {<br /> MySqlCommand my_comm = new MySqlCommand();<br /> my_comm.Connection = my_con;<br /> my_comm.CommandType = System.Data.CommandType.StoredProcedure;<br /> my_comm.CommandText = "CALL pr_view_peop";<br /><br /> MySqlDataAdapter my_adapter = new MySqlDataAdapter(my_comm.CommandText, my_con);<br /><br /> DataTable dt = new DataTable();<br /> my_adapter.Fill(dt);<br /><br /> dataGridView1.DataSource = dt;<br /> }<br /> catch (Exception ex)<br /> {<br /> MessageBox.Show(ex.Message);<br /> }<br /> }<br /> else <br /> { <br /> //!!!!!!!!!!!!!!!<br /> }Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7352323701912967109.post-54136271699529709772010-03-26T03:08:06.275-07:002010-03-26T03:08:06.275-07:00Thanks for the cast workaround to return types get...Thanks for the cast workaround to return types getting messed up when selecting a @variable value through the connector. I am seeing some truly weird behavior, but this workaround allows me to move on at least.Lars Ole Avery Simonsenhttps://www.blogger.com/profile/04279971886080625192noreply@blogger.comtag:blogger.com,1999:blog-7352323701912967109.post-49166935188134863702009-02-23T13:10:00.000-08:002009-02-23T13:10:00.000-08:00There is a performance penalty for retrieving and ...There is a performance penalty for retrieving and storing the stored procedure bodies.<BR/><BR/>I don't know why but i really like this sentence. Makes me think. If you take it out the context of what your saying... its a real mind buster. <BR/><BR/>:)Donna B. Isobelhttps://www.blogger.com/profile/10247945924133840795noreply@blogger.comtag:blogger.com,1999:blog-7352323701912967109.post-72593305934978572682009-02-12T19:35:00.000-08:002009-02-12T19:35:00.000-08:00The "Use Procedure Bodies" does not work. I have t...The "Use Procedure Bodies" does not work. I have tried it and it does not make a difference. <BR/><BR/>Here is what the documentation says:<BR/><BR/><I>Instructs the provider to attempt to call the procedure without first resolving the metadata. Thjis is useful in situations where the calling user does not have access to the mysql.proc table. To use this mode, the parameters for the procedure must be added to the command in the same order as they appear in the procedure definition and their types must be explicitly set. </I><BR/><BR/>Here is what actually happens:<BR/><BR/>Using the latest version of Connector/Net, which is 5.2.5, call a stored procedure with no parameters and monitor the network traffic. You will see it doing a select to retrieve the definition of the stored procedure.<BR/><BR/>Maybe at some point in the future they will fix this so that it works as described in the documentation, but even with this there is still the issue that you have to add the parameters with types in the proper order, which is not going to be obvious to someone who comes along later and looks at your code.Mark Cordellhttps://www.blogger.com/profile/16591034905871282738noreply@blogger.comtag:blogger.com,1999:blog-7352323701912967109.post-69381419484376971422009-02-11T22:25:00.000-08:002009-02-11T22:25:00.000-08:00Version 5.2 (MySQL 5.1) has a switch in the connec...Version 5.2 (MySQL 5.1) has a switch in the connection string that is called "Use Procedure Bodies". This is normally set to true, and causes the driver to connect the server and query the proc table that is NOT in the databases where the user has created them. This causes the problem cited in the post. Because the user may not have the rights to perform a select operation on that table<BR/>If we set the Use Procedure Bodies to false we simply get rid of this problem. Setting this value to false implies that driver cannot derive the types of the parameters and the user has to specifically set the type of each parameter.<BR/><BR/>The reason in which MySQL handles procedures is quite weird and strongly limits the portability of code...hyp0th3rmi4https://www.blogger.com/profile/08478627676496957309noreply@blogger.com