?? 成績查詢.txt
字號:
using System;
using System.Data;
using System.Data.SqlClient;
namespace Aptech.Student.DataAccess
{
using Aptech.Student.Common;
/// <summary>
/// Scores 類的摘要說明。
/// 對成績表相關的操作
/// </summary>
public class Scores
{
private DataBaseOperate dbObject = null;
private bool bConn = false;
public Scores()
{
dbObject = new DataBaseOperate();
bConn = false;
}
public Scores(DataBaseOperate dbOperate)
{
dbObject = dbOperate;
bConn = true;
}
/*添加成績信息*/
public bool InsertScore(int iCourseId,int iStudentId,float iScore)
{
string sqlStr = "insert Score values("+iCourseId+","+iStudentId+","+iScore+")";
try
{
dbObject.Execute(sqlStr);
}
catch(Exception e)
{
throw e;
}
return true;
}
/*修改成績信息*/
public bool UpdateScore(int uScoreId,int uCourseId,int uStudentId,float uScore)
{
string sqlStr = "update Score set CourseId = "
+uCourseId
+"StudentId = "
+uStudentId
+"Score = "
+uScore
+"where ScoreId = "
+uScoreId;
try
{
dbObject.Execute(sqlStr);
}
catch(Exception e)
{
throw e;
}
return true;
}
/*查詢成績信息:根據學生ID、課程ID、班級ID的任意組合作為查詢*/
public DataSet SelectScore(int sCourseId,int sStudentId,int sClassId)
{
string sqlStr = "select Score.ScoreId,Score.StudentId,Score.CourseId,Score.Score,Student.ClassId "
+" from Score "
+" inner join Student "
+" on Score.StudentId = Student.StudentId"
+" where 1=1";
if(sCourseId!=-1)
{
sqlStr+=" and CourseId = "+sCourseId+")";
}
if(sStudentId!=-1)
{
sqlStr+=" and StudentId = "+sStudentId+")";
}
if(sClassId!=-1)
{
sqlStr+=" and ClassId = "+sClassId+")";
}
DataSet ds = new DataSet();
try
{
dbObject.Search(sqlStr,"Score");
}
catch(Exception e)
{
throw e;
}
return;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -