zoukankan      html  css  js  c++  java
  • 数据库操作类的封装


            public static string conString = @"Server=localhost;Integrated Security=True; Database=northwind";

    1. 执行Sql语句, 返回受影响的行数
    Code
    调用方法:
            string strSql=@"select * from Customers";
            
    int rows = ExecuteSql(strSql);
    不知道为什么, 测试了一下, 返回的rows竟然是-1. 暂时没有找到原因.

    2. 执行查询语句, 返回DataSet
    Code
    调用方法:
            string strSql = @"select * from Customers";
            DataSet ds 
    = Utility.Query(strSql);

    3. 执行一条计算查询结果语句, 返回查询结果(object)
    Code
    调用方法:
            string strSql = @"select * from Customers";
            
    string num = Utility.GetSingle(strSql).ToString();

    5. 带参数, 执行SQL语句, 返回影响的记录数
    ..............
  • 相关阅读:
    如何制作挖空的填空题试卷?
    原型制图工具有哪些?
    书籍推荐?来几本吧
    离线部署ELK+kafka日志管理系统【转】
    Elasticsearch5.0 安装问题集锦【转】
    在Nginx服务器上屏蔽IP
    MySQL Warning: Using a password on the command line interface can be insecure.解决办法
    不老的神器:安全扫描器Nmap渗透使用指南【转】
    MySQL数据库设置为只读及测试【转】
    Linux中切换用户变成-bash4.1-$的解决方法
  • 原文地址:https://www.cnblogs.com/niuniu1985/p/1564246.html
Copyright © 2011-2022 走看看