c#事务回滚
c#事务回滚(转)
作者:xue5ya 来源:博客园 发布时间:2009-03-20 16:08 阅读:263 次 原文链接 [收藏]
Code
public void UpdateContactTableByDataSet(DataSet ds,string strTblName)
{
try
{
string strConnection ="server = ;database = ;uid = ;pwd = ;Connec Timeout = 60 ";
SqlDataAdapter myAdapter = new SqlDataAdapter();
SqlConnection conn = new SqlConnection(strConnection);
SqlCommand myCommand = new SqlCommand("select * from strTblName",conn);
myAdapter.SelectCommand = myCommand;
SqlCommandBuilder myCommandBuilder = new SqlCommandBuilder(myAdapter);
conn.Open();
SqlTransaction myTrans = conn.BeginTransaction();
myCommand.Transaction = myTrans;
try
{
myAdapter.Update(ds,strTblName);
myTrans.Commit();
}
 
相关文档:
本文将介绍C#项目打包以及自动安装SQL Sever数据库,包括创建部署项目、将主程序项目的输出添加到部署项目中、创建安装程序类、创建自定义安装对话框等等。
’power by: landlordh
’for 2000,xp,2003
Module uninstall
Sub Main ......
参考《ASP.NET与SQL一起打包部署安装》
,这篇文章是针对VB.NET与SQL 一起打包的,但是我使用的是C#,当然只要修改一下主要安装类库就行了!C#的类库代码如下:DBCustomAction.cs
using System;
using System.Collections;
using System.Data.SqlClient;
using System.ComponentModel;
using System.Configuration.Inst ......
using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;//Cryptography密码术
namespace DAL
{
public class Enc ......
1. 简述 private、 protected、 public、 internal 修饰符的访问权限。
答 . private : 私有成员, 在类的内部才可以访问。
protected : 保护成员,该类内部和继承类中可以访问。
public : 公共成员,完全公开,没有访问限制。
internal: 在同一命名空间内可以访问。
2 .列举ASP.N ......