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();
}
 
相关文档:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
//sqlserver身份验证
//string sqlconn = "ser ......
本文将介绍C#项目打包以及自动安装SQL Sever数据库,包括创建部署项目、将主程序项目的输出添加到部署项目中、创建安装程序类、创建自定义安装对话框等等。
’power by: landlordh
’for 2000,xp,2003
Module uninstall
Sub Main ......
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 ......
先声明,我不是这方面的专家,只是干软件四个月不知天有多高地有多硬的小孩子
首先,类型转换是有一定开销的
我试过这样的代码:这是一个控制台应用程序的Program类的代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace 类型转换的开销
{
class Program
......