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

📄 course.cs

📁 毕业设计题目,学生成绩查询系统,包括管理员和普通用户两级管理
💻 CS
字号:
using System;
using System.Data;
using System.Data.SqlClient;
namespace StudentScroeQuery.DAL
{
	/// <summary>
	/// course 的摘要说明。
	/// </summary>
	public class course:helper
	{
		public course()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}
		public void add_course(string name)
		{
			this.comm.CommandText="insert into Course(Course_Name) values(@name)";
			comm.Parameters.Add("@name",SqlDbType.VarChar).Value=name;
			this.ExcuteCommandReturnVoid(comm);
		}
		public bool isDupplicatedNameAtadd(string name)
		{
			this.comm.CommandText="select count(Course_Id) from Course where Course_Name=@name ";
			comm.Parameters.Add("@name",SqlDbType.VarChar).Value=name;
			int bl=this.ExcuteCommandReturnNumber(comm);
			if(bl==0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		//重写isDupplicatedNameAtadd方法
		public bool isDupplicatedNameAtadd(string name,int id)
		{
			comm.CommandText="select count(Course_Id) from  Course where Course_Id<>@id and Course_name=@name";
			comm.Parameters.Add("@name",SqlDbType.VarChar).Value=name;
			comm.Parameters.Add("@id",SqlDbType.Int).Value=id;
			return (this.ExcuteCommandReturnNumber(comm)==0);
		}
		public DataSet get_allcourse()
		{
			return this.ExcuteSqlReturnDataSet("select * from Course order by Course_Id desc ");
		}
		public void del_course(int id)
		{
			comm.CommandText="delete from Course where Course_Id=@id";
			comm.Parameters.Add("@id",SqlDbType.Int).Value=id;
			this.ExcuteCommandReturnVoid(comm);
		}
		public void update_course(int id,string name)
		{
			comm.CommandText="update Course set Course_Name=@name where Course_Id=@id";
			comm.Parameters.Add("@name",SqlDbType.VarChar).Value=name;
			comm.Parameters.Add("@id",SqlDbType.Int).Value=id;
			this.ExcuteCommandReturnVoid(comm);


		}		
	}
}

⌨️ 快捷键说明

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