資源簡介
一個簡單的asp.net動態(tài)網(wǎng)站,可供初學(xué)者參考
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Web;
using?System.Web.UI;
using?System.Web.UI.WebControls;
using?System.Collections;
using?System.Configuration;
using?System.Data;
using?System.Web.Security;
using?System.Web.UI.HtmlControls;
using?System.Web.UI.WebControls.WebParts;
using?System.xml.Linq;
using?System.Data.SqlClient;
using?System.Web.Configuration;
public?partial?class?_Default?:?System.Web.UI.Page
{
????Class1?CC?=?new?Class1();
????protected?void?Page_Load(object?sender?EventArgs?e)
????{
????????if?(!IsPostBack)
????????{
????????????GridView1_Bind();
????????}
????}
????private?void?GridView1_Bind()
????{
????????string?strcon?=?ConfigurationManager.ConnectionStrings[“tangren“].ConnectionString;
????????string?selstr?=?“select?*?from?messages“;
????????SqlConnection?conn?=?new?SqlConnection(strcon);
????????SqlDataAdapter?da?=?new?SqlDataAdapter(selstr?conn);
????????conn.Open();
????????DataSet?ds?=?new?DataSet();
????????da.Fill(ds);
????????this.GridView1.DataSource?=?ds;
????????this.GridView1.DataKeyNames?=?new?string[]?{?“remark“?};
????????this.GridView1.DataBind();
????????conn.Close();
????}
????private?string?getConnectionString()
????{
????????return?WebConfigurationManager.ConnectionStrings[“tangren“].ConnectionString;
????}
????protected?void?GridView1_RowDeleting(object?sender?GridViewDeleteEventArgs?e)
????{
????????string?remark?=?GridView1.DataKeys[e.RowIndex].Value.ToString();
????????using?(SqlConnection?connection?=?new?SqlConnection(getConnectionString()))
????????{
????????????SqlCommand?command?=?new?SqlCommand();
????????????command.Connection?=?connection;
????????????command.CommandType?=?CommandType.Text;
????????????command.CommandText?=?“Delete?messages?WHERE?remark=‘“?+?remark?+?“‘“;
????????????connection.Open();
????????????try
????????????{
????????????????command.ExecuteNonQuery();
????????????????Response.Write(“ript>alert(‘刪除成功‘) ript>“);
????????????????command.Dispose();
????????????????connection.Close();
????????????}
????????????catch?(Exception?ex)
????????????{
????????????????Response.Write(“ript>alert(“?+?ex.Message?+?“) ript>“);
????????????}
????????????finally
????????????{
????????????????command.Dispose();
????????????????connection.Close();
????????????}
????????????GridView1.EditIndex?=?-1;
????????????GridView1_Bind();
????????}
????}
????protected?void?GridView1_SelectedIndexChanged(object?sender?EventArgs?e)
????{
????}
????protected?void?Button1_Click(object?sender?EventArgs?e)
????{
????????Response.Redirect(“~//后臺主頁.aspx“);
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-12-11?18:10??ASP.NET\
?????目錄???????????0??2014-12-11?18:10??ASP.NET\a\
?????目錄???????????0??2014-12-11?18:10??ASP.NET\App_Code\
?????文件????????1344??2014-06-04?23:17??ASP.NET\App_Code\cd.cs
?????文件????????9153??2014-06-05?00:21??ASP.NET\App_Code\Class1.cs
?????文件????????1770??2014-06-04?23:12??ASP.NET\App_Code\da.cs
?????文件?????????748??2014-06-04?23:36??ASP.NET\App_Code\databa
?????文件????????1086??2014-06-04?23:10??ASP.NET\App_Code\rd.cs
?????文件????????4653??2014-06-04?23:09??ASP.NET\App_Code\SAclass.cs
?????目錄???????????0??2014-12-11?18:10??ASP.NET\App_Data\
?????文件?????2359296??2014-06-30?16:10??ASP.NET\App_Data\tangren.mdf
?????文件??????589824??2014-06-30?16:10??ASP.NET\App_Data\tangren_log.LDF
?????文件???????11402??2014-06-08?14:43??ASP.NET\a\1.jpg
?????文件??????175088??2014-06-15?12:21??ASP.NET\a\11.jpg
?????文件??????151678??2014-06-08?14:43??ASP.NET\a\12.jpg
?????文件??????190379??2014-06-08?14:44??ASP.NET\a\13.jpg
?????文件??????133318??2014-06-08?14:50??ASP.NET\a\21.jpg
?????文件??????126424??2014-06-13?11:39??ASP.NET\a\22.jpg
?????文件??????121701??2014-06-13?16:42??ASP.NET\a\24.jpg
?????文件???????51038??2014-06-13?13:27??ASP.NET\a\31.jpg
?????文件???????26779??2014-06-08?14:36??ASP.NET\a\hg.jpg
?????文件???????28013??2014-06-13?16:46??ASP.NET\a\jjf.jpg
?????文件??????159348??2014-06-13?13:30??ASP.NET\a\lgx.jpg
?????文件??????143059??2014-06-29?18:44??ASP.NET\a\lss.jpg
?????文件???????37193??2014-05-22?22:29??ASP.NET\a\nz.jpg
?????文件???????28938??2014-05-22?22:31??ASP.NET\a\syz.jpg
?????文件???????46944??2014-06-12?22:48??ASP.NET\a\xcq.jpg
?????文件??????108572??2014-06-07?11:46??ASP.NET\a\yh.jpg
?????文件???????47167??2014-06-13?13:23??ASP.NET\a\射雕.jpg
?????文件????????3759??2014-06-17?19:54??ASP.NET\Default.aspx
?????文件????????2715??2014-06-17?19:35??ASP.NET\Default.aspx.cs
............此處省略291個文件信息
- 上一篇:C#版GIS軟件源碼
- 下一篇:c#Winform獲取攝像頭掃描各種碼
評論
共有 條評論