資源簡介
開發環境
1.開發工具:Visual Studio 2005
2.開發平臺:Windows XP sp2
3.數據庫:Sql server 2000
增加功能:
1.個人資料
2.添加好友詳細信息
3.添加好友照片
4.更新好友照片
5.增加備注信息
6.數據庫文件在App_Data文件夾下.直接附加后,在webconfig里修改一下配置.
*系統默認帳號密碼:myaddresslist/123456

代碼片段和文件信息
using?System;
using?System.Data;
using?System.Configuration;
using?System.Collections;
using?System.Web;
using?System.Web.Security;
using?System.Web.UI;
using?System.Web.UI.WebControls;
using?System.Web.UI.WebControls.WebParts;
using?System.Web.UI.HtmlControls;
using?System.Data.SqlClient;
using?System.IO;
public?partial?class?AmendPhoto?:?System.Web.UI.Page
{
????protected?void?Page_Load(object?sender?EventArgs?e)
????{
????????if?(!IsPostBack)
????????{
????????????dataBind();
????????????lblphoto.Visible?=?false;
????????????Uploadpri.Visible?=?false;
????????????this.BtnPhoto.Visible?=?false;
????????????this.lblmsg.Visible?=?false;
????????????this.lblfrdinf.Visible?=?false;
????????????this.lblupdata.Visible?=?false;
??????????
????????}
????}
????private?void?dataBind()
????{
????????string?ID?=?Session[“userId“].ToString();
????????string?sql?=?“select?*?from?addresslist?where?userId=‘“?+?ID?+?“‘?order?by?id?desc“;
????????Database?DB?=?new?Database();
????????DataSet?ds?=?DB.DataAll(sql);
????????GridView1.DataSource?=?ds;
????????GridView1.DataKeyNames?=?new?string[]?{?“id“?};
????????GridView1.DataBind();
????????return;
????}
????protected?void?GridView1_SelectedIndexChanged(object?sender?EventArgs?e)
????{
????????//ViewState[“id“]?=?GridView1.DataKeys[GridView1.SelectedIndex].ToString();
????????lblphoto.Visible?=?true;
????????Uploadpri.Visible?=?true;
????????this.BtnPhoto.Visible?=?true;
????????this.lblmsg.Visible?=?true;
????????this.lblfrdinf.Visible?=?true;
????????this.lblupdata.Visible?=?true;
????????int?uid?=?Convert.ToInt32(GridView1.SelectedValue.ToString());
????????string?frdname?=?Database.Getfield(“select?frdname?from?addresslist?where?id=“?+?uid?“frdname“);
????????lblfrdinf.Text?=?frdname.ToString();
????????lblfrdinf.style[“color“]?=?“red“;
??????
????}
????protected?void?BtnPhoto_Click(object?sender?EventArgs?e)
????{
????????
????????
????????SqlConnection?conn1?=?new?SqlConnection(ConfigurationManager.ConnectionStrings[“ConnectionString“].ConnectionString);
????????int?uid?=?Convert.ToInt32(GridView1.SelectedValue.ToString());
???????
????????string?imgname?=?Database.Getfield(“select?frdImageUrl?from?AddressList?where?id=“?+?uid?“frdImageUrl“);
????????if?(imgname?!=?““)
????????{
??????????imgname?=?imgname.Substring(imgname.LastIndexOf(“/“)?+?1);
??????????File.Delete(Server.MapPath(“./Pictures“)?+?“//“?+?imgname);
????????}
????????
????????string?fileName?=?Uploadpri.PostedFile.FileName;
????????string?fileName2?=?Uploadpri.PostedFile.FileName.Substring(fileName.LastIndexOf(“\\“)?+?1);
????????string?type1?=?fileName2.Substring(fileName2.LastIndexOf(“.“)?+?1);
????????string?typeToLower?=?type1.ToLower();
????????if?(typeToLower?==?“bmp“?||?typeToLower?==?“gif“?||?typeToLower?==?“jpg“||typeToLower==““)
????????{
????????????//DateTime?time?=?new?DateTime();
????????????string?newtime?=?System.DateTime.Now.ToString(
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????3229??2008-01-01?00:40??communication\AmendPhoto.aspx
?????文件???????4714??2008-01-01?00:53??communication\AmendPhoto.aspx.cs
?????文件???????1027??2008-03-30?13:34??communication\App_Code\amendPassword.cs
?????文件???????3485??2008-10-01?00:37??communication\App_Code\Attribute.cs
?????文件???????5180??2008-01-01?01:43??communication\App_Code\Databa
?????文件???????1149??2008-01-01?02:01??communication\App_Code\GetValue.cs
?????文件???????2677??2008-10-01?00:37??communication\App_Code\operation.cs
?????文件????????133??2004-04-03?23:14??communication\App_Code\新云軟件.url
?????文件????1179648??2008-11-25?08:55??communication\App_Data\Address_Data.MDF
?????文件????1048576??2008-11-25?08:55??communication\App_Data\Address_Log.LDF
?????文件????????509??2008-01-01?04:49??communication\Default.aspx
?????文件????????706??2008-06-10?18:48??communication\Default.aspx.cs
?????文件???????3747??2008-01-01?06:34??communication\DeleteData.aspx
?????文件???????5071??2008-11-25?08:55??communication\DeleteData.aspx.cs
?????文件???????6825??2008-10-01?02:59??communication\editorGridview.aspx
?????文件???????6138??2008-10-01?00:51??communication\editorGridview.aspx.cs
?????文件??????10323??2008-01-01?01:29??communication\GridViewUsage.aspx
?????文件???????7728??2008-01-01?01:07??communication\GridViewUsage.aspx.cs
?????文件??????44565??2008-11-01?16:50??communication\image\069cq[1].gif
?????文件?????121915??2008-01-01?00:54??communication\image\11.jpg
?????文件???????3612??2008-07-26?21:47??communication\image\56logo.gif
?????文件???????1576??2008-07-26?13:12??communication\image\baidu.gif
?????文件???????5045??2008-11-01?15:24??communication\image\Beethoven.jpg
?????文件?????????47??2004-08-30?16:01??communication\image\bg.gif
?????文件????????230??2002-04-24?22:42??communication\image\close.gif
?????文件???????3222??2008-07-26?21:30??communication\image\dh_video_lmy_002.gif
?????文件?????254442??2008-07-19?13:42??communication\image\dragon.jpg
?????文件?????????62??2007-06-16?17:44??communication\image\empty.gif
?????文件????????375??2007-06-16?17:44??communication\image\folder.gif
?????文件???????4945??2007-07-18?09:38??communication\image\from.gif
............此處省略61個文件信息
評論
共有 條評論