⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mer.cs

📁 用C#实现超市的管理
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace Chulicheng
{
    public class mer
    {
        SqlConnection con = new SqlConnection("server=(local);uid=sa;pwd=sa;database=student");
        public bool insertReun(string sql)
        {
           
            SqlCommand comm = new SqlCommand(sql,con);
            con.Open();
            if (comm.ExecuteNonQuery() > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        
        }
        public DataSet SelectReun(string sql)
        {

            try
            {
                SqlDataAdapter da = new SqlDataAdapter(sql, this.con);

                DataSet ds = new DataSet();
                da.Fill(ds);
                return ds;
            }
            catch (Exception)
            {
                
                throw;
            }
        
        }
        public bool DeleteReun(string sql)
        {
            SqlCommand comm = new SqlCommand(sql,con);
            con.Open();
            if (comm.ExecuteNonQuery() > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public bool UpdateReun(string sql,SqlParameter[] param)
        {
            SqlCommand comm = new SqlCommand(sql,con);
            comm.Parameters.AddRange(param);
            con.Open();
            if (comm.ExecuteNonQuery() > 0)
            {
                return true;

            }
            else
            {
                return false;
            }
        
        }

        public bool SelectReud(string sql)
        {

            SqlCommand comm = new SqlCommand(sql, con);
             con.Open();

             return (int)comm.ExecuteScalar() > 0 ? true : false;

        }



    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -