asp教程.net c# java调用mysql教程存储过程方法
本文章主要介绍三种asp.net教程 c# java调用mysql存储过程方法,一一举例说明了关于如何创建如调用mysql存储过程的方法哦。
简单存储过程
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() //"删除"的存储过程
{
string str_orgid = client_str; //获得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"; //存储过程名
//mycomm.parameters.add("m_orgid", str_orgid);
mycomm.executenonquery();
}
catch
{
mycomm.connection.close();
mycomm.dispose();
}
finally
{
mycomm.connection.close();
mycomm.dispose();
}
}
首页 1 2 末页