mer.cs
来自「用C#实现超市的管理」· CS 代码 · 共 90 行
CS
90 行
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 + =
减小字号Ctrl + -
显示快捷键?