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();
}
 
相关文档:
源码如下:
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
{
......
参考资料:http://wenwen.soso.com/z/q39607884.htm
如何在一个窗体中调用另一个窗体的控件或方法
答案是从构造函数中传递参数。
要把Form1中的控间改成public属性
具体实现过程请参看一下代码(在form2的textbox1中输入然后在form1中的label1中显示textbox中的内容
//form1代码,form1中有一个label1和一个button1,其 ......
/// <summary>
/// 缩小裁剪图片
/// </summary>
/// <param name="int_Width">要缩小裁剪图片宽度</param>
/// <param name="int_Height">要缩小裁剪图片长度</param>
/// <param name="input_ImgUrl">要处理图片路径< ......
C#实现Windows Form的透明背景用下面这段代码能实现非常有意思真正的透明背景,透明的地方不仅能显示其下一层的图案,而且能让鼠标穿越过去,成为真正的透明化。
注释掉的3行中,前2行代码是实现透明效果的另外第一个办法,最后1行是第三种办法。
但第一个方法根本不起作用,因为Windows Form所用“调色板”是&l ......
private void save_db(){
SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings[""].ToString());
SqlCommand comm = new SqlCommand();
conn.Open();
SqlTransaction rollbk2= conn.BeginTransaction();
& ......