Asp.net c # java call mysql Stored Procedure Method (1/2)

Source: Internet
Author: User

Asp.net c # java call mysql Stored Procedure method this article mainly introduces three methods of asp.net c # java call mysql stored procedure, one by one illustrates how to create a method such as calling mysql stored procedure.

Asp tutorial. net c # java call mysql tutorial Stored Procedure Method
This article mainly introduces three asp.net tutorial c # java methods for calling mysql stored procedures. One by one examples illustrate how to create a mysql stored procedure, for example.

Simple Stored Procedure


Create procedure 'deleteb' (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 Procedure
{
String str_orgid = client_str; // obtain the 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"; // name of the stored procedure
// Mycomm. parameters. add ("m_orgid", str_orgid );
Mycomm.exe cutenonquery ();
}
Catch
{
Mycomm. connection. close ();
Mycomm. dispose ();
}
Finally
{
Mycomm. connection. close ();
Mycomm. dispose ();
}
}

1 2

Related Article

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.