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语句, 返回影响的记录数
    ..............
  • 相关阅读:
    linux_一些shell命令分析记录
    linux shell if
    linux_磁盘挂载
    远程工具记录
    oracle_多字段统计(多count)
    tomcat_日志打印格式问题
    cgo -rpath指定动态库路径
    Ubuntu下两个gcc版本切换
    [转]Go与C语言的互操作
    [转]【流媒體】H264—MP4格式及在MP4文件中提取H264的SPS、PPS及码流
  • 原文地址:https://www.cnblogs.com/niuniu1985/p/1564246.html
Copyright © 2011-2022 走看看