ADO.NET最佳实践(中)[10]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 spidertan 的 blog

    console.writeline("update successful.")

  catch e as exception

    try

      mytrans.rollback()

    catch ex as sqlexception

      if not mytrans.connection is nothing then

        console.writeline("an exception of type " & ex.gettype().tostring() & _

                          " was encountered while attempting to roll back the transaction.")

      end if

    end try

    console.writeline("an exception of type " & e.gettype().tostring() & " was encountered.")

    console.writeline("update failed.")

  end try

  myconnection.close()

end sub

‘c#

public void runsqltransaction(sqldataadapter da, sqlconnection myconnection, dataset ds)

{

  myconnection.open();

  sqltransaction mytrans = myconnection.begintransaction();

本文关键:数据库设计
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top