zoukankan
html css js c++ java
DbDataAdapter对象UpdataBatchSize属性批量修改
private
void
rowUpdated(
object
sender, SqlRowUpdatedEventArgs e)
{
sb.Append(
"
Rows:
"
+
e.RecordsAffected.ToString()
+
"
\r\n
"
);
}
private
void
btnUpdateBatch_Click(
object
sender, EventArgs e)
{
//
event subsciption is normally placed in constructor but is here
//
to encapsulate the sample
da.RowUpdated
+=
new
SqlRowUpdatedEventHandler(rowUpdated);
ConnectionStringSettings pubs
=
ConfigurationManager.ConnectionStrings[
"
PubsData
"
];
DbConnection connection
=
new
SqlConnection(pubs.ConnectionString);
SqlCommand cmd
=
(SqlCommand)connection.CreateCommand();
cmd.CommandType
=
CommandType.Text;
cmd.CommandText
=
"
SELECT * FROM Publishers
"
;
da.SelectCommand
=
cmd;
DataSet pubsDataSet
=
new
DataSet(
"
Pubs
"
);
SqlCommandBuilder bldr
=
new
SqlCommandBuilder(da);
da.Fill(pubsDataSet,
"
publishers
"
);
//
Modify data here
foreach
(DataRow dr
in
pubsDataSet.Tables[
"
publishers
"
].Rows)
{
dr[
"
pub_name
"
]
=
"
Updated Toys
"
;
}
da.UpdateBatchSize
=3
;
da.Update(pubsDataSet,
"
publishers
"
);
//
if event subscription is in the contructor, no need to
//
remove it here
.
da.RowUpdated
-=
new
SqlRowUpdatedEventHandler(rowUpdated);
MessageBox.Show(sb.ToString());
}
查看全文
相关阅读:
深入理解ThreadLocal
synchronized与Lock的区别与使用
1亿个数中找出最小的100个数--最小堆
B+/-Tree原理(mysql索引数据结构)
深入理解token
shiro(java安全框架)
第一次项目上Linux服务器(四:CentOS6下Mysql数据库的安装与配置(转))
第一次项目上Linux服务器(三:安装Tomcat及相关命令)
第一次项目上Linux服务器(二:——安装jdk)
第一次项目上Linux服务器(一:远程连接服务器)
原文地址:https://www.cnblogs.com/zwl12549/p/865089.html
最新文章
D1. Prefix-Suffix Palindrome (Easy version)
A. Powered Addition
A. Orac and LCM
Nastya and Strange Generator
Cell Phone Contacts
Inverted Deck
Oracle PL/SQL语言函数、匿名语句及循环
Oracle 视图和索引
大数据
Oracle 函数
热门文章
Oracle 多表查询、查询运算符和集合运算
Oracle 三大范式
Oracle 聚合函数
oracle 基本操作--事务
Oracle 约束
Oracle 基本操作--数据类型、修改和删除表、增删改查和复制表
java面试宝典
tcp三次握手和四次挥手
Socket编程
Session、Cookie详解(2)
Copyright © 2011-2022 走看看