温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:WebQuest发布系统源码及文档
当前文件:
WebQuest/App_Code/Subjects.cs,打开代码结构图
WebQuest/App_Code/Subjects.cs,打开代码结构图1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Web; 5
using System.Web.Security; 6
using System.Web.UI; 7
using System.Web.UI.WebControls; 8
using System.Web.UI.WebControls.WebParts; 9
using System.Web.UI.HtmlControls; 10
using System.Data.OleDb; 11
//该源码下载自www.51aspx.com(51aspx.com) 12
13
/// <summary> 14
/// Subjects 的摘要说明 15
/// </summary> 16
namespace WebQuest 17
{ 18
私有成员及属性 50
public int Create() 51
{ 52
try 53
{ 54
AccessDB myObj = new AccessDB(); 55
myObj.SqlStr = "insert into webquest_subjects(subjectname,description) values('" + _subjectName + "','" + _description + "') "; 56
myObj.ExecuteSqlStr(); 57
return 0; 58
} 59
catch (Exception a) 60
{ 61
62
throw a; 63
return -1; 64
} 65
} 66
public DataSet Retrieve() 67
{ 68
AccessDB myObj = new AccessDB(); 69
myObj.SqlStr = "select * from webquest_subjects "; 70
return myObj.ExecuteSqlStrReturnDs(); 71
} 72
public int Update() 73
{ 74
try 75
{ 76
AccessDB myObj = new AccessDB(); 77
myObj.SqlStr = "update webquest_subjects set subjectname='"+_subjectName+"',description='"+_description+"' where subjectid="+_subjectId.ToString(); 78
myObj.ExecuteSqlStr(); 79
return 0; 80
} 81
catch (Exception a) 82
{ 83
84
throw a; 85
return -1; 86
} 87
} 88
public int Delete() 89
{ 90
try 91
{ 92
AccessDB myObj = new AccessDB(); 93
myObj.SqlStr = "delete from webquest_subjects where subjectid=" + _subjectId.ToString(); 94
myObj.ExecuteSqlStr(); 95
return 0; 96
} 97
catch (Exception a) 98
{ 99
100
throw a; 101
return -1; 102
} 103
} 104
public OleDbDataReader RetrieveById() 105
{ AccessDB myObj = new AccessDB(); 106
myObj.SqlStr = "select * from webquest_subjects where subjectid=" + _subjectId.ToString(); 107
return myObj.ExecuteSqlStrReturnDr(); 108
} 109
public Subjects() 110
{ 111
// 112
// TODO: 在此处添加构造函数逻辑 113
// 114
} 115
} 116
117
}







}