1 .net 用事物提交执行存储过程
2024-10-06 19:25:13
public static void delModelReturn(string performanceId,DateTime? effectiveDate=null)
{ using (SqlConnection con = GetEditorConnection())
{
con.Open();
using (SqlCommand command = con.CreateCommand())
{
SqlTransaction st = con.BeginTransaction();
command.Transaction = st;
try
{
command.CommandText = "delModelReturn";
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(new SqlParameter("@p_PerformanceId", performanceId));
if (!effectiveDate.HasValue)
{
command.Parameters.Add(new SqlParameter("@p_EffectiveDate", DBNull.Value));
}
else
{
command.Parameters.Add(new SqlParameter("@p_EffectiveDate",effectiveDate));
}
command.ExecuteNonQuery();
st.Commit();
}
catch (Exception ex)
{
st.Rollback();
throw new Exception(ex.Message);
} }
con.Close(); }
}
最新文章
- cf593c
- kali安装java1.7
- spring mvc <;mvc:default-servlet-handler />; 。
- Socket网络编程--FTP客户端
- PHP 遍历目录
- 多个div 一行显示的处理方式
- poj1222 EXTENDED LIGHTS OUT
- Junit单元测试学习笔记一
- Java Notes 00 - Singleton Pattern(单例总结)
- [cocos2d-x]针对不同的设备,选取不同的自适应图片
- emacs 只读打开文件
- python数组并集交集补集
- hdfs核心主件服务的启停方式
- python阅读目录
- 牛客练习赛31 D神器大师泰兹瑞与威穆
- http协议的学习
- Linux下新建服务
- 【java】详解集合
- create-react-app 使用详解
- Web(click and script) 与 Web(HTTP/HTML)协议区别