示例#1
0
        /// <summary>
        /// 插入数据库(静态方法)
        /// </summary>
        /// <param name="sql"></param>
        public static int insertDatabase(string sql)
        {
            DBGetter  dbg = new DBGetter();
            DBControl dbc = new DBControl(dbg.getDatabase());

            dbc.Open();
            int i = dbc.ExecuteNonSQL(sql);

            dbc.Close();
            return(i);
        }
示例#2
0
        /// <summary>
        /// 判断在记录是否唯一
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        public static bool recordIsExist(string sql)
        {
            int       i;
            DBGetter  dbg = new DBGetter();
            DBControl dbc = new DBControl(dbg.getDatabase());

            dbc.Open();
            i = (int)dbc.ExecuteScalar(sql);
            dbc.Close();
            return(i == 1 ? true : false);
        }
示例#3
0
        /// <summary>
        /// 获取数据集
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        public DataSet getDataSet(string sql)
        {
            DataSet   ds  = new DataSet();
            DBGetter  dbg = new DBGetter();
            DBControl dbc = new DBControl(dbg.getDatabase());

            dbc.Open();
            IDbCommand com = dbc.DBF.getDBCommand();

            com.CommandText = sql;
            com.Connection  = dbc.DBF.getDBConnection();
            IDataAdapter sda = dbc.DBF.getDataAdapter(com);

            sda.Fill(ds);
            dbc.Close();
            return(ds);
        }