易截截图软件、单文件、免安装、纯绿色、仅160KB

C# 回滚1

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#中对 XML节点进行增、删、改、查

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
namespace WebApplication2
{
    /// <summary>
    /// XMLHelper XML文档操作管理器
  &nb ......

ASP.NET(C#)常用代码30例

1. 打开新的窗口并传送参数:
  传送参数:
response.write("<script>window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)</script>")
  接收参数:
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
  2.为按钮添加对话框
Button1 ......

c# 操作excel

 OleDbConnection conn = null;
            try
            {
               `string strConn;
  &n ......

C#自动关机源码

源码如下:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.IO;
using Microsoft.Win32;
namespace mv
{ ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号