示例#1
0
        /// <summary>
        ///执行SQL语句
        /// </summary>
        /// <param name="str">SQL语句</param>
        public static void non(string str)
        {
            SqlConnection sql = CourseSys.sql();
            SqlCommand    cmd = new SqlCommand(str, sql);

            cmd.ExecuteNonQuery();
            sql.Close();
        }
示例#2
0
        /// <summary>
        /// 返回DataTable集
        /// </summary>
        /// <param name="str">SQL语句</param>
        /// <returns></returns>
        public static DataTable gettb(string str)
        {
            SqlConnection  sql  = CourseSys.sql();
            SqlDataAdapter sda  = new SqlDataAdapter(str, sql);
            DataSet        dbds = new DataSet();

            sda.Fill(dbds);
            sql.Close();
            return(dbds.Tables[0]);
        }