存储过程执行select与insert同一个表sql语句
public void onedb_twoconnect()
{
using (transactionscope scope = new transactionscope())
{
mysql教程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);
cmd1.executenonquery();
mysqlconnection conn2 = new mysqlconnection("server=127.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);
cmd3.parameters.add("@companyid", guid.newguid());
cmd3.parameters.add("@companyname", "testsss");
cmd3.parameters.add("@createtime", datetime.now);
cmd3.parameters.add("@createuser", "test");
cmd3.executenonquery();
scope.complete();
}
}