sqlcommand.ExecuteNonQuery(), 多条语句超时问题..
using (SqlConnection conn = new SqlConnection(connectionString))
{
conn.Open();
SqlCommand command = new SqlCommand(sql, conn);
command.ExecuteNonQuery();
conn.Close();
}
现在有一个这样的问题,我sql的内容是
SET IDENTITY_INSERT [dbo].[Table] ON
INSERT [dbo].[Table] ([ID], [Name],....)VALUES (3818, 'name1',...)
INSERT [dbo].[Table] ([ID], [Name],....)VALUES (3819, 'name2',...)
INSERT [dbo].[Table] ([ID], [Name],....)VALUES (3820, 'name3',...)
... //大概3000条
...
...
SET IDENTITY_INSERT [dbo].[Nop_LocaleStringResource] OFF
插入语句大概有3000条
这样,我执行上边的方法,会出现超时现象,我不太明白为什么?
然后我将这3000条插入语句减少了一部分,正常运行..
是不是command.ExecuteNonQuery();有什么限制呢?
碰到这种情况难道要分好几次执行么?
谢谢
...全文
相关推荐
SqlCommand_ExecuteNonQuery方法
SqlCommand_ExecuteNonQuery方法,亲自运行过,没有问题初学者参考
使用Sqlcommand执行SQL语句
使用Sqlcommand执行SQL语句使用Sqlcommand执行SQL语句
ExecuteReader(),ExecuteNonQuery(),ExecuteScalar(),ExecuteXmlReader()之间的区别
ExecuteReader(),ExecuteNonQuery(),ExecuteScalar(),ExecuteXmlReader()之间的区别 主要有这么几种,cmd.ExecuteReader();cmd.ExecuteNonQuery();cmd.ExecuteScalar();cmd.ExecuteXmlReader();) 1,ExecuteReader();返回一个SqlDataReader对象或OleDbDataReader对象,这个看你的程序的需要去 做。可以通过这个对象来检查查询结果,它提供了“游水”式的执行方式,即从结果中读取一行之后,移动到另一行,则前一行
ExecuteNonQuery();ExecuteReader();ExecuteScalar();的简单用法
数据库几个方法ExecuteNonQuery();ExecuteReader();ExecuteScalar();的简单用法
执行多条SQL语句,实现数据库事务。
执行多条SQL语句,实现数据库事务。保证数据的准确性。可能有人会用到哦


