C#中挪用MySQL存儲進程的辦法。本站提示廣大學習愛好者:(C#中挪用MySQL存儲進程的辦法)文章只能為提供參考,不一定能成為您想要的結果。以下是C#中挪用MySQL存儲進程的辦法正文
本文實例講述了C#中挪用MySQL存儲進程的辦法。分享給年夜家供年夜家參考。詳細以下:
這段代碼演示在 C# 法式中挪用 MySQL 的存儲進程,沒有前往值,沒有參數傳遞。
MySqlConnection myConnection; myConnection = new MySqlConnection(); myConnection.ConnectionString = "database="+database+";server="+ server+";user id="+user+";Password="+password; try { myConnection.Open(); } catch (MySqlException MyException) { Console.WriteLine("Connection error: MySQL code: "+ MyException.Number +" "+ MyException.Message); } try { MySqlCommand myCommand = new MySqlCommand( "call error_test_proc(1)", myConnection ); myCommand.ExecuteNonQuery(); } catch (MySqlException MyException) { Console.WriteLine("Stored procedure error: MySQL code: " + MyException.Number + " " + MyException.Message); }
願望本文所述對年夜家的C#法式設計有所贊助。