温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:WebQuest发布系统源码及文档
当前文件:
WebQuest/App_Code/ModelsContent.cs,打开代码结构图
WebQuest/App_Code/ModelsContent.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
/// <summary> 12
/// ModelsContent 的摘要说明 13
/// </summary> 14
namespace WebQuest 15
{ 16
public class ModelsContent 17
{ 18
私有成员与属性 50
public int Update() 51
{ 52
try 53
{ 54
AccessDB myObj = new AccessDB(); 55
myObj.SqlStr = "update Webquest_Models_Content set content='" + _content + "' where modelContentId=" +_modelContentId.ToString(); 56
myObj.ExecuteSqlStr(); 57
return 0; 58
} 59
catch (Exception a) 60
{ 61
62
throw a; 63
return -1; 64
} 65
} 66
public int Delete() 67
{ 68
AccessDB myObj = new AccessDB(); 69
myObj.SqlStr = "delete from Webquest_Models_Content where ModelContentId=" + _modelContentId.ToString(); myObj.ExecuteSqlStr(); 70
return 0; 71
} 72
public OleDbDataReader RetrieveAll() 73
{ 74
AccessDB myObj = new AccessDB(); 75
myObj.SqlStr = "select * from Webquest_Models_Content where webquestid=" + _webquestId.ToString(); 76
return myObj.ExecuteSqlStrReturnDr(); 77
} 78
public OleDbDataReader RetrieveContent() 79
{ 80
AccessDB myObj = new AccessDB(); 81
myObj.SqlStr = "select * from Webquest_Models_Content where modelid=" + _modelId.ToString() + " and webquestid=" + _webquestId.ToString() + " order by modelcontentid asc"; 82
return myObj.ExecuteSqlStrReturnDr(); 83
} 84
public int Create() 85
{ 86
try 87
{ 88
AccessDB myObj = new AccessDB(); 89
myObj.SqlStr = "insert into Webquest_Models_Content (webquestid,modelid,content) values ('" + _webquestId + "','" + _modelId + "','" + _content + "')"; 90
myObj.ExecuteSqlStr(); 91
return 0; 92
} 93
catch (Exception) 94
{ 95
96
throw; 97
return -1; 98
} 99
} 100
public DataSet Retrieve() 101
{ 102
AccessDB myObj = new AccessDB(); 103
myObj.SqlStr = "select * from Webquest_Models_Content where webquestid="+_webquestId.ToString(); 104
return myObj.ExecuteSqlStrReturnDs(); 105
} 106
107
public ModelsContent() 108
{ 109
// 110
// TODO: 在此处添加构造函数逻辑 111
// 112
} 113
} 114
} 115







}