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语句, 返回影响的记录数
    ..............
  • 相关阅读:
    Django 基础教程
    Python之路【第十七篇】:Django【进阶篇 】
    Python之路【第十六篇】:Django【基础篇】
    Python之路【第十五篇】:Web框架
    AngularJS 教程
    jQuery
    最小公倍数生成树
    51nod 1743 雪之国度
    codeforces 633F The Chocolate Spree
    hihocoder 1246 王胖浩与环
  • 原文地址:https://www.cnblogs.com/niuniu1985/p/1564246.html
Copyright © 2011-2022 走看看