Asp.net源码专业站
首页->新闻文章->jimmyNews(Asp.net新闻系统)1.0源码>>Admin/class/Add.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:jimmyNews(Asp.net新闻系统)1.0源码
当前文件:文件类型 jimmyNews/Admin/class/Add.aspx.cs[3K,2009-6-12 11:45:38]打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Data.OleDb; 4using System.Configuration; 5using System.Collections; 6using System.Web; 7using System.Web.Security; 8using System.Web.UI; 9using System.Web.UI.WebControls; 10using System.Web.UI.WebControls.WebParts; 11using System.Web.UI.HtmlControls; 12using Wuqi.Webdiyer; 13using CFCHINA.TOOLS.ACCESS; 14using CFCHINA.TOOLS.EnDecode; 15using CFCHINA.TOOLS.COMM; 16 17public partial class Admin_Class_Add : System.Web.UI.Page 18{ 19 private DataBase db = new DataBase(); 20 private Tools tl = new Tools(); 21 private OleDbConnection conn = null; 22 private string strSql = ""; 23 24 protected void Page_Load(object sender, EventArgs e) 25 { 26 InitPage(); 27 28 if (!IsPostBack) 29 { 30 hdPage.Value = tl.GetPageIndex(); 31 txtOrder.Text = getMaxOrder(); 32 } 33 } 34 35 protected void InitPage() 36 { 37 this.Page.Title = ConfigurationManager.AppSettings["webtitle"].ToString() + "_增加分类"; 38 ((Label)(this.Master.FindControl("lblTitle"))).Text = "分类列表_增加分类"; 39 40 41 } 42 43 /// <summary> 44 /// 添加用户 45 /// </summary> 46 protected void AddData(string goUrl) 47 { 48 try 49 { 50 strSql = "select * from cf_Class where ucase(trim(cf_Name))='" + tl.GetSafeStr(this.txtClassName.Text.ToUpper().Trim()) + "'"; 51 if (db.ExistDate(strSql)) 52 { 53 tl.Alert("该分类已经存在,请检查!", "javascript:window.history.back();"); 54 } 55 else 56 { 57 conn = db.GetConn(); 58 Guid GID = tl.NewComb(); 59 60 string[] f = {"cf_id", "cf_Name", "cf_ReadMe","cf_Sort"}; 61 string[] v = { GID.ToString(), this.txtClassName.Text, this.txtReadme.Text,this.txtOrder.Text}; 62 63 if (db.InsertData("cf_Class", f, v)) 64 { 65 tl.Alert("增加记录成功!", goUrl); 66 } 67 else 68 { 69 tl.Alert("增加记录失败!", "javascript:window.history.back()"); 70 } 71 72 } 73 74 } 75 catch (Exception ex) 76 { 77 tl.Alert(ex.Message.ToString().Replace("'", ""), "javascript:window.history.back()"); 78 } 79 80 } 81 82 protected void btnAdd_Click(object sender, EventArgs e) 83 { 84 AddData("default.aspx?page=" + hdPage.Value); 85 } 86 87 protected void btnAddNew_Click(object sender, EventArgs e) 88 { 89 AddData("Add.aspx?page=" + hdPage.Value); 90 } 91 92 /// <summary> 93 /// 得到最大排序号 94 /// </summary> 95 /// <returns></returns> 96 protected string getMaxOrder() { 97 strSql = "select Max(cf_Sort) from cf_Class"; 98 string result = "0"; 99 conn = db.GetConn(); 100 OleDbDataReader dr = db.RunSql(strSql,conn); 101 if (dr.HasRows) { 102 if (dr.Read()) { 103 result = dr[0].ToString(); 104 } 105 } 106 dr.Close(); 107 db.Dispose(conn); 108 return result; 109 } 110} 111
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:jimmyNews(Asp.net新闻系统)1.0源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146