因为msdn中说返回受影响的行数: Executes a Transact-SQL statement against the connection and returns the number of rows affected. 但是却没看到备注里说 For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command. When a trigger e…
在使用ExecuteNonQuery(),调用存储过程,语句执行无错误,但是返回结果一直是-1 原因: 当使用储存过程时, 要把SET NOCOUNT ON 这个语句去掉, 这样数据就有反回值了 当 SET NOCOUNT 为 ON 时,不返回计数(表示受Transact-SQL 语句影响的行数). 当 SET NOCOUNT 为 OFF 时,返回计数.…
数据库连接字符串(web.config来配置),可以动态更改connectionString支持多数据库. SqlServer调用数据库 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Configuration; using System.Data; using System.Data.…
1.创建DbHelperMySQL类 2.复制代码到类中 using System; using System.Collections; using System.Collections.Specialized; using System.Data; using MySql.Data.MySqlClient; using System.Configuration; using System.Data.Common; using System.Collections.Generic; namesp…