{
sqlDataAdpter.Fill(dt);
trans.Commit();
}
catch (Exception e)
{
trans.Rollback();
throw new Exception("执行数据库操作失败, sql: " + sqlStr, e);
}
finally
{
sqlDataAdpter.Dispose();
cmd.Dispose();
trans.Dispose();
CloseConnection();
}
return dt;
}
public DataSet FillDataSet(string sqlStr, CommandType cmdType, List<DbParameter> listParams)
{
OpenConnection();
DbTransaction trans = sqlConn.BeginTransaction();
DbCommand cmd = CreateDbCommd(sqlConn, trans, sqlStr, cmdType, listParams);
SqlDataAdapter sqlDataAdpter = new SqlDataAdapter(cmd as SqlCommand);
DataSet ds = new DataSet();
try
{
sqlDataAdpter.Fill(ds);
trans.Commit();
}
catch (Exception e)
{
trans.Rollback();
throw new Exception("执行数据库操作失败, sql: " + sqlStr, e);
}
finally
{
sqlDataAdpter.Dispose();
cmd.Dispose();
trans.Dispose();
CloseConnection();
}
return ds;
}
public object ExecuteScalar(string sqlStr, CommandType cmdType, List<DbParameter> listParams)
{
object result = null;
OpenConnection();
DbTransaction trans = sqlConn.BeginTransaction();
try
3/13 首页 上一页 1 2 3 4 5 6 下一页 尾页 |