惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
I
InfoQ
宝玉的分享
宝玉的分享
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
P
Privacy International News Feed
T
Threatpost
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Vulnerabilities – Threatpost
NISL@THU
NISL@THU
aimingoo的专栏
aimingoo的专栏
S
Schneier on Security
C
Cisco Blogs
T
The Blog of Author Tim Ferriss
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
雷峰网
雷峰网
Know Your Adversary
Know Your Adversary
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
I
Intezer
博客园 - Franky
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
The Hacker News
The Hacker News
K
Kaspersky official blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Tailwind CSS Blog
Project Zero
Project Zero
T
Tor Project blog
B
Blog RSS Feed
Recorded Future
Recorded Future
Scott Helme
Scott Helme
美团技术团队
V
V2EX
V
Visual Studio Blog
L
Lohrmann on Cybersecurity
P
Proofpoint News Feed
D
DataBreaches.Net
The Register - Security
The Register - Security
M
MIT News - Artificial intelligence
L
LangChain Blog
Cisco Talos Blog
Cisco Talos Blog
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园_首页
P
Privacy & Cybersecurity Law Blog

博客园 - 小诈

[.net]正则表达式整理 今日所思 伟大的意大利夺冠了!疯狂庆祝! word add-in 卸载时如何清除自定义的按钮和菜单 制作包含.net framework的安装包 解决不能上网的问题(Wincock绑架) [ASP.NET揭密读书笔记]额外的控件和资源 [ASP.NET揭密读书笔记]应用程序跟踪和监视 [ASP.NET揭密读书笔记]用户自定义控件 [ASP.NET揭密读书笔记]连接池 安装Ubuntu 痛苦的胃镜检查 [转载]微软好员工的十个标准 新年新气象,恭喜发财 WEB中服务器端Table的行集中要注意ViewState 2005年年终总结 招聘.NET高级软件工程师 DataTable.Select方法的性能问题 [转贴]Visual Studio 2005常用插件搜罗
[ASP.NET揭密读书笔记]ADO.NET介绍
小诈 · 2006-06-26 · via 博客园 - 小诈

一、Creating an ASP.NET Page Transaction--页面事务
Finally, you can create a transaction at the level of an ASP.NET page. You can enroll an ASP.NET page in a transaction by adding one of the following page directives to the ASP.NET page:

Disabled— Transactions are disabled for the page. This is the default value.

NotSupported— Indicates that the page does not execute within a transaction.

Supported— If a transaction already exists, the page will execute within the context of the transaction. However, it will not create a new transaction.

Required— If a transaction already exists, the page will execute within the context of the transaction. If a transaction does not exist, it will create a new one.

RequiresNew— Creates a new transaction for each request.

Try
  cmdUpdateAccountA.ExecuteNonQuery()
  cmdUpdateAccountB.ExecuteNonQuery()

  ' Commit the transaction
  ContextUtil.SetComplete()
  Response.Write( "Transaction Successful!" )
Catch ex As Exception
  ContextUtil.SetAbort()
  Response.Write( "Transaction Failed!" )
Finally
  conBank.Close()

二、Specifying a Command Behavior,可以获取第一个记录,表的结构信息等
When you call the ExecuteReader() method of the Command object you can pass an optional CommandBehavior parameter. By supplying the CommandBehavior parameter, you can gain greater control over how the ExecuteReader() method retrieves data from a database.

The CommandBehavior enumeration has the following values:

CloseConnection— Automatically closes an open database connection after the DataReader is closed.

KeyInfo— Retrieves column and primary key with the data. Executes the query with the FOR BROWSE clause.

SchemaOnly— Retrieves column and table schema information without retrieving data.

SequentialAccess— Enables access to database columns that contain a large amount of information.

SingleResult— Optimizes the command to retrieve only a single result.

SingleRow— Optimizes the command to retrieve only a single row. If multiple rows are returned, additional rows are discarded.