?? user_manage_upfiles.aspx.cs
字號:
?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;
using lalablog;
public partial class user_user_manage_upfiles : System.Web.UI.Page
{
int id;
string fullname;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["userid"] == null)
Response.Redirect("~/user/userLogin.aspx?url="+Server .HtmlEncode(Request .RawUrl ));
}
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
id = Convert.ToInt32(e.Keys["id"].ToString());
getPath();
File.Delete(this.fullname.Trim ());
}
private void getPath()
{
String path = MapPath("~/uploadfiles/");
string strconn = ConfigurationManager.ConnectionStrings["dsn"].ToString();
SqlConnection cn = new SqlConnection(strconn);
cn.Open();
string sql = "select upfilename from pic where id=" + this.id;
SqlCommand cm = new SqlCommand(sql, cn);
try
{
SqlDataReader dr = cm.ExecuteReader();
if (dr.Read())
this.fullname = path + dr["upfilename"].ToString();
}
catch (SqlException ex)
{
myfunc my = new myfunc(ex.Message);
Response.Write(my.JavaMsg());
}
finally
{
cn.Close();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -