The stored procedure executes the select statement and the insert statement in the same table.
Public void onedb_twoconnect ()
{
Using (transactionscope scope = new transactionscope ())
{
Mysql tutorial connection conn1 = new mysqlconnection ("server = 127.0.0.1; database = test; uid = root; pwd = 123 ");
Conn1.open ();
Mysqlcommand cmd1 = new mysqlcommand ("select * from company", conn1 );
Statement 1.executenonquery ();
Mysqlconnection conn2 = new mysqlconnection ("server = Wagner. 0.0.1; database = test; uid = root; pwd = 123 ");
Conn2.open ();
Mysqlcommand cmd3 = new mysqlcommand ("insert into company (companyid, companyname, createtime, createuser) values (@ companyid, @ companyname, @ createtime, @ createuser)", conn2 );
Parameters 3.parameters. add ("@ companyid", guid. newguid ());
Listen 3.parameters. add ("@ companyname", "testsss ");
Parameters 3.parameters. add ("@ createtime", datetime. now );
Parameters 3.parameters. add ("@ createuser", "test ");
Statement 3.executenonquery ();
Scope. complete ();
}
}