asp.net C # java invoke MySQL stored procedure method (1/2)

Source: Internet
Author: User

ASP tutorial. NET C # java calling MySQL tutorial stored procedure methods
This article mainly introduces three kinds of asp.net tutorial C # java Call MySQL stored procedure method, each example illustrates how to create such as invoking the MySQL stored procedures OH.

Simple stored Procedures


CREATE PROCEDURE ' Deletedb ' (in M_orgid char (12))
Begin
Delete from Hardwareinfo where orgid=m_orgid;
Delete from AddressInfo where orgid=m_orgid;
End


Aspx.net

public void Delete_procedure ()//"delete" stored procedures
{
string str_orgid = Client_str; Get OrgID
String myconn_str = webconfigurationmanager.connectionstrings["mysqlconnectionstring"].connectionstring;
Mysqlconnection myconn = new Mysqlconnection (MYCONN_STR);
Mysqlcommand Mycomm = new Mysqlcommand ("Deletedb", myconn);//(CLIENT_STR);
Mycomm.connection = myconn;
Try
{
Mycomm.connection.open ();
Mycomm.commandtype = CommandType.StoredProcedure;
Mysqlparameter Myparameter;
Myparameter = new Mysqlparameter ("? M_orgid", mysqldbtype.string);
Myparameter.value = Str_orgid;
Myparameter.direction = ParameterDirection.Input;
Mycomm.parameters.add (Myparameter);

Mycomm.commandtext = "Deletedb"; Stored Procedure Name
Mycomm.parameters.add ("M_orgid", Str_orgid);
Mycomm.executenonquery ();
}
Catch
{
Mycomm.connection.close ();
Mycomm.dispose ();
}
Finally
{
Mycomm.connection.close ();
Mycomm.dispose ();
}
}

Home 1 2 last page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.