本文整理汇总了C#中MySql.Data.MySqlClient.MySqlTransaction类的典型用法代码示例。如果您正苦于以下问题:C# MySqlTransaction类的具体用法?C# MySqlTransaction怎么用?C# MySqlTransaction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MySqlTransaction类属于MySql.Data.MySqlClient命名空间,在下文中一共展示了MySqlTransaction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: MySqlTransactionScope
public MySqlTransactionScope(MySqlConnection con, Transaction trans,
MySqlTransaction simpleTransaction)
{
connection = con;
baseTransaction = trans;
this.simpleTransaction = simpleTransaction;
}
开发者ID:seeseekey,项目名称:CSCL,代码行数:7,代码来源:MySqlPromotableTransaction.cs
示例2: ExecuteCommand
//带参数的执行命令
public static int ExecuteCommand(MySqlTransaction mySqlTransaction,string sql, params MySqlParameter[] values)
{
using (MySqlConnection connection = new MySqlConnection(connectionString))
{
try
{
connection.Open();
mySqlTransaction = connection.BeginTransaction();
MySqlCommand cmd = new MySqlCommand(sql, connection, mySqlTransaction);
cmd.Parameters.AddRange(values);
cmd.ExecuteNonQuery(); // ExecuteNonQuery()一般用于UPDATE、INSERT或DELETE语句,其中唯一的返回值是受影响的记录个数
mySqlTransaction.Commit();
return 1;
}
catch
{
mySqlTransaction.Rollback();
return 0;
}
finally
{
connection.Close();
}
}
}
开发者ID:carriercomm,项目名称:BillingSystem,代码行数:27,代码来源:MySqlDbHelper.cs
示例3: AdaptadorInsert
private static MySqlDataAdapter AdaptadorInsert(MySqlConnection SqlConnection1, MySqlTransaction tr)
{
SqlDataAdapter1 = new MySqlDataAdapter();
SqlInsertCommand1 = new MySqlCommand("Articulos_Insertar", SqlConnection1);
SqlInsertCommand1.Transaction = tr;
SqlDataAdapter1.InsertCommand = SqlInsertCommand1;
// IMPLEMENTACIÓN DE LA ORDEN INSERT
SqlInsertCommand1.Parameters.Add("p_id", MySqlDbType.VarChar, 55, "IdArticuloART");
SqlInsertCommand1.Parameters.Add("p_idItem", MySqlDbType.Int32, 11, "IdItemART");
SqlInsertCommand1.Parameters.Add("p_idColor", MySqlDbType.Int32, 11, "IdColorART");
SqlInsertCommand1.Parameters.Add("p_idAlicuota", MySqlDbType.Int16, 3, "IdAliculotaIvaART");
SqlInsertCommand1.Parameters.Add("p_talle", MySqlDbType.VarChar, 50, "TalleART");
SqlInsertCommand1.Parameters.Add("p_idProveedor", MySqlDbType.Int32, 11, "IdProveedorART");
SqlInsertCommand1.Parameters.Add("p_descripcion", MySqlDbType.VarChar, 55, "DescripcionART");
SqlInsertCommand1.Parameters.Add("p_descripcionWeb", MySqlDbType.VarChar, 50, "DescripcionWebART");
SqlInsertCommand1.Parameters.Add("p_precioCosto", MySqlDbType.Decimal, 19, "PrecioCostoART");
SqlInsertCommand1.Parameters.Add("p_precioPublico", MySqlDbType.Decimal, 19, "PrecioPublicoART");
SqlInsertCommand1.Parameters.Add("p_precioMayor", MySqlDbType.Decimal, 19, "PrecioMayorART");
SqlInsertCommand1.Parameters.Add("p_fecha", MySqlDbType.DateTime, 19, "FechaART");
SqlInsertCommand1.Parameters.Add("p_imagen", MySqlDbType.VarChar, 50, "ImagenART");
SqlInsertCommand1.Parameters.Add("p_imagenBack", MySqlDbType.VarChar, 50, "ImagenBackART");
SqlInsertCommand1.Parameters.Add("p_imagenColor", MySqlDbType.VarChar, 50, "ImagenColorART");
SqlInsertCommand1.Parameters.Add("p_activoWeb", MySqlDbType.Int32, 1, "ActivoWebART");
SqlInsertCommand1.Parameters.Add("p_nuevo", MySqlDbType.Int32, 1, "NuevoART");
SqlInsertCommand1.CommandType = CommandType.StoredProcedure;
return SqlDataAdapter1;
}
开发者ID:BenjaOtero,项目名称:trend-pos,代码行数:29,代码来源:ArticulosDAL.cs
示例4: AdaptadorABM
private static MySqlDataAdapter AdaptadorABM(MySqlConnection SqlConnection1, MySqlTransaction tr)
{
SqlDataAdapter1 = new MySqlDataAdapter();
SqlInsertCommand1 = new MySqlCommand("TesoreriaMov_Insertar", SqlConnection1);
SqlUpdateCommand1 = new MySqlCommand("TesoreriaMov_Actualizar", SqlConnection1);
SqlDeleteCommand1 = new MySqlCommand("TesoreriaMov_Borrar", SqlConnection1);
SqlInsertCommand1.Transaction = tr;
SqlUpdateCommand1.Transaction = tr;
SqlDeleteCommand1.Transaction = tr;
SqlDataAdapter1.DeleteCommand = SqlDeleteCommand1;
SqlDataAdapter1.InsertCommand = SqlInsertCommand1;
SqlDataAdapter1.UpdateCommand = SqlUpdateCommand1;
// IMPLEMENTACIÓN DE LA ORDEN UPDATE
SqlUpdateCommand1.Parameters.Add("p_id", MySqlDbType.Int32, 11, "IdMovTESM");
SqlUpdateCommand1.Parameters.Add("p_fecha", MySqlDbType.DateTime, 20,"FechaTESM");
SqlUpdateCommand1.Parameters.Add("p_pc", MySqlDbType.Int32, 11, "IdPcTESM");
SqlUpdateCommand1.Parameters.Add("p_detalle", MySqlDbType.VarChar, 200, "DetalleTESM");
SqlUpdateCommand1.Parameters.Add("p_importe", MySqlDbType.Double, 50, "ImporteTESM");
SqlUpdateCommand1.CommandType = CommandType.StoredProcedure;
// IMPLEMENTACIÓN DE LA ORDEN INSERT
SqlInsertCommand1.Parameters.Add("p_id", MySqlDbType.Int32, 11, "IdMovTESM");
SqlInsertCommand1.Parameters.Add("p_fecha", MySqlDbType.DateTime, 20, "FechaTESM");
SqlInsertCommand1.Parameters.Add("p_pc", MySqlDbType.Int32, 11, "IdPcTESM");
SqlInsertCommand1.Parameters.Add("p_detalle", MySqlDbType.VarChar, 200, "DetalleTESM");
SqlInsertCommand1.Parameters.Add("p_importe", MySqlDbType.Double, 50, "ImporteTESM");
SqlInsertCommand1.CommandType = CommandType.StoredProcedure;
// IMPLEMENTACIÓN DE LA ORDEN DELETE
SqlDeleteCommand1.Parameters.Add("p_id", MySqlDbType.Int32, 11, "IdMovTESM");
SqlDeleteCommand1.CommandType = CommandType.StoredProcedure;
return SqlDataAdapter1;
}
开发者ID:BenjaOtero,项目名称:trend-gestion-desktop,代码行数:34,代码来源:TesoreriaMovimientosDAL.cs
示例5: ExecuteDatarow
public static DataRow ExecuteDatarow(MySqlConnection connection, MySqlTransaction transaction, string commandText, params MySqlParameter[] parms)
{
var dt = ExecuteDataTable(connection, transaction, commandText, parms);
if (dt == null) return null;
if (dt.Rows.Count == 0) return null;
return dt.Rows[0];
}
开发者ID:ullassagar,项目名称:eshop,代码行数:7,代码来源:MysqlRepository.cs
示例6: dbAtualizarContador
public Boolean dbAtualizarContador(INFOParametros pObjParametros, MySqlTransaction pObjTrans)
{
StringBuilder strSQL = null;
double contador = pObjParametros.NumeroContador + 1;
try
{
strSQL = new StringBuilder();
strSQL.AppendLine("UPDATE parametros SET ");
strSQL.AppendLine(" NR_CONTADOR = " + contador);
if (dbExecutarQuery(strSQL.ToString(), pObjTrans) > 0)
{
return true;
}
else
{
return false;
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
strSQL = null;
}
}
开发者ID:jspengine,项目名称:SIGPA-DIGITAL,代码行数:30,代码来源:DALParametros.cs
示例7: MySqlCommand
/// <include file='docs/mysqlcommand.xml' path='docs/ctor4/*'/>
public MySqlCommand(string cmdText, MySqlConnection connection,
MySqlTransaction transaction)
:
this(cmdText, connection)
{
curTransaction = transaction;
}
开发者ID:maanshancss,项目名称:ClassLibrary,代码行数:8,代码来源:command.cs
示例8: ExecuteNonQuery
/// <summary>
///使用现有的SQL事务执行一个sql命令(不返回数据集)
/// </summary>
/// <remarks>
///举例:
/// int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, "PublishOrders", new MySqlParameter("@prodid", 24));
/// </remarks>
/// <param name="trans">一个现有的事务</param>
/// <param name="cmdType">命令类型(存储过程, 文本, 等等)</param>
/// <param name="cmdText">存储过程名称或者sql命令语句</param>
/// <param name="commandParameters">执行命令所用参数的集合</param>
/// <returns>执行命令所影响的行数</returns>
public static int ExecuteNonQuery(MySqlTransaction trans, CommandType cmdType, string cmdText, params MySqlParameter[] commandParameters) {
MySqlCommand cmd = new MySqlCommand();
PrepareCommand(cmd, trans.Connection, trans, cmdType, cmdText, commandParameters);
int val = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
return val;
}
开发者ID:freaky0112,项目名称:SocketTest,代码行数:19,代码来源:MysqlHelper.cs
示例9: MySqlCommand
public MySqlCommand(string commandText, MySqlConnection connection, MySqlTransaction transaction)
{
CommandText = commandText;
DbConnection = connection;
DbTransaction = transaction;
m_parameterCollection = new MySqlParameterCollection();
}
开发者ID:yaozhenfa,项目名称:MySqlConnector,代码行数:7,代码来源:MySqlCommand.cs
示例10: PrepareCommand
private static void PrepareCommand(MySqlCommand cmd, MySqlConnection conn, MySqlTransaction trans, CommandType cmdType, string cmdText, Dictionary<string, object> cmdParms)
{
if (conn.State != ConnectionState.Open)
{
conn.Open();
}
cmd.Connection = conn;
cmd.CommandText = cmdText;
if (trans != null)
{
cmd.Transaction = trans;
}
cmd.CommandType = cmdType;
if (cmdParms != null)
{
foreach (var param in cmdParms)
{
var parameter = cmd.CreateParameter();
parameter.ParameterName = param.Key;
parameter.Value = param.Value;
cmd.Parameters.Add(parameter);
}
}
}
开发者ID:yeti0506,项目名称:MySqlIdentity,代码行数:25,代码来源:MySqlHelper.cs
示例11: MasterPOSConnection
public MasterPOSConnection(MySqlConnection Connection, MySqlTransaction Transaction)
{
mConnection = Connection;
mTransaction = Transaction;
GetConnection();
}
开发者ID:marioricci,项目名称:erp-luma,代码行数:7,代码来源:MasterMySqlDataConnection.cs
示例12: Execute
public void Execute(MySqlConnection connection, MySqlTransaction transaction)
{
CallProcInsertWorldEntry(connection, transaction, mDungeonList.World);
foreach (DataDungeon dungeon in mDungeonList.Dungeons)
CallProcInsertDungeonEntry(connection, transaction, mDungeonList.World, dungeon);
}
开发者ID:JulianoW,项目名称:ffrkx,代码行数:7,代码来源:DbOpRecordDungeonList.cs
示例13: ExecuteScalar
public static string ExecuteScalar(string SQL, MySqlConnection conn, MySqlTransaction tran)
{
if (conn.State != ConnectionState.Open)
conn.Open();
MySqlCommand cmd = new MySqlCommand(SQL, conn, tran);
return cmd.ExecuteScalar().ToString();
}
开发者ID:rpertence,项目名称:AmorPraBicho,代码行数:8,代码来源:conexao.cs
示例14: ExecuteNonQuery
public static void ExecuteNonQuery(string SQL, MySqlConnection conn, MySqlTransaction tran)
{
if (conn.State != ConnectionState.Open)
conn.Open();
MySqlCommand cmd = new MySqlCommand(SQL, conn, tran);
cmd.ExecuteNonQuery();
cmd.Dispose();
}
开发者ID:rpertence,项目名称:AmorPraBicho,代码行数:9,代码来源:conexao.cs
示例15: CallProcRecordBattleEncounter
private int CallProcRecordBattleEncounter(MySqlConnection connection, MySqlTransaction transaction, DataActiveBattle battle)
{
using (MySqlCommand command = new MySqlCommand("record_battle_encounter", connection, transaction))
{
command.CommandType = System.Data.CommandType.StoredProcedure;
command.Parameters.AddWithValue("@battle_id", battle.BattleId);
return command.ExecuteNonQuery();
}
}
开发者ID:JulianoW,项目名称:ffrkx,代码行数:9,代码来源:DbOpRecordBattleEncounter.cs
示例16: GetCommand
public MySqlCommand GetCommand(string sql, MySqlTransaction trans)
{
//Command
MySqlCommand command = new MySqlCommand();
command.CommandText = sql;
command.Connection = trans.Connection;
command.Transaction = trans;
return command;
}
开发者ID:Strather,项目名称:DataInserter,代码行数:10,代码来源:Connection.cs
示例17: CallProcInsertEnemyEntry
int CallProcInsertEnemyEntry(MySqlConnection connection, MySqlTransaction transaction, uint EnemyId, string EnemyName)
{
using (MySqlCommand command = new MySqlCommand("insert_enemy_entry", connection, transaction))
{
command.CommandType = System.Data.CommandType.StoredProcedure;
command.Parameters.AddWithValue("@enemy_id", EnemyId);
command.Parameters.AddWithValue("@enemy_name", EnemyName);
return command.ExecuteNonQuery();
}
}
开发者ID:JulianoW,项目名称:ffrkx,代码行数:10,代码来源:DbOpRecordBattleEncounter.cs
示例18: init
private void init(string connString) {
connection = new MySqlConnection(connString);
connection.Open();
connection.ChangeDatabase(Server.MySQLDatabaseName);
transaction = connection.BeginTransaction();
}
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:7,代码来源:MySQLTransactionHelper.cs
示例19: CommitTran
public void CommitTran()
{
if (_tran != null)
{
_tran.Commit();
_tran = null;
}
}
开发者ID:webxiaohua,项目名称:SmartORM,代码行数:8,代码来源:MySQLHelper.cs
示例20: Commit
public void Commit(int id)
{
if (this.transaction != null && id == transactionId && id != -1) {
transaction.Commit ();
this.CloseConnection ();
transaction = null;
}
}
开发者ID:RicardoEPRodrigues,项目名称:LetsParty,代码行数:8,代码来源:DatabaseEntity.cs
注:本文中的MySql.Data.MySqlClient.MySqlTransaction类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论