📄 symptomaccess.cs
字号:
using System;
using comman;
using System.Data;
namespace DataAccess
{
/// <summary>
/// Symptom 的摘要说明。
/// </summary>
public class SymptomAccess
{
DBconnection cn = new DBconnection();
public SymptomAccess()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public DataTable SelectSym()
{
string commandText = string.Format(@"SELECT Symptom.ID, Symptom.SymptomName, Symptom.BelongOffID,
Dictionary.Detail
FROM Symptom INNER JOIN
Dictionary ON Symptom.BelongOffID = Dictionary.ID");
return DBAccess.ExcuteDataTable(cn.Connection,commandText);
}
public int AddSym(Symptom symptom)
{
string commandText = string.Format(@"INSERT INTO Symptom (SymptomName,BelongOffID) VALUES ('{0}','{1}')",symptom.SymptomName,symptom.BelongOffID);
return DBAccess.ExcuteCommand(cn.Connection,commandText);
}
public int UpdateSym(Symptom symptom,int ID)
{
string commandText = string.Format(@"UPDATE Symptom SET SymptomName = '{0}',BelongOffID = '{1}' WHERE ID = '{2}'",symptom.SymptomName,symptom.BelongOffID,ID);
return DBAccess.ExcuteCommand(cn.Connection,commandText);
}
public int DeleteSym(int ID)
{
string commandText = string.Format(@"DELETE FROM Symptom WHERE ID = {0}",ID);
return DBAccess.ExcuteCommand(cn.Connection,commandText);
}
public DataTable SerchSym(string SymName,int BelongOffID)
{
string commandText = string.Format(@"SELECT Symptom.ID, Symptom.SymptomName, Symptom.BelongOffID,
Dictionary.Detail
FROM Symptom INNER JOIN
Dictionary ON Symptom.BelongOffID = Dictionary.ID");
string Null = "";
string where = " WHERE";
if(SymName != "")
{
if(Null == "")
commandText += where;
commandText += Null+string.Format(" Symptom.SymptomName LIKE '{0}'",SymName);
Null = " AND";
}
if(BelongOffID != -1)
{
if(Null == "")
commandText += where;
commandText += Null + string.Format(" Symptom.BelongOffID = '{0}'",BelongOffID);
Null = " AND";
}
return DBAccess.ExcuteDataTable(cn.Connection,commandText);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -