日期:2014-05-17 浏览次数:20463 次
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
using (TransactionScope trans = new TransactionScope())
{
using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DotNetDb"].ConnectionString))
{
try
{
conn.Open();
SqlCommand cmd;
cmd = new SqlCommand("insert into employee values(8,'A','设计部','北京','a@126.com')", conn);
cmd.ExecuteNonQuery();
cmd = new SqlCommand("insert into employee values(8,'B','程序部','上海','b@sohu.com')", conn);
cmd.ExecuteNonQuery();
this.Label1.Text = "OK!";
}
catch(Exception ex)
{
this.Label1.Text = ex.Message;
&nb