using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.Sql;
using System.Data.SqlClient;
using System.IO;
using System.Data;
using System.Web.SessionState;namespace WSBBS
{
public partial class modify : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
localhost.Service1 myService1;
myService1 = new localhost.Service1(); string strConn;
SqlConnectionStringBuilder strCnn = new SqlConnectionStringBuilder();
strCnn.DataSource = @"(local)\SQLExpress";
strCnn.InitialCatalog = "BBS";
strCnn.IntegratedSecurity = true; strConn = strCnn.ConnectionString; DataSet myDS;
myDS = new DataSet(); if (Session["UserID"].ToString()!= "")
{
string strID = Session["UserID"].ToString(); string connectstring = " select * from [UserManager] where UserID =" + "'" + strID + "'"; myDS = myService1.GetsDS(connectstring, strConn); DataRow myRow = myDS.Tables[0].Rows[0]; NameTextBox.Text = myRow["name"].ToString();
EmailTextBox.Text = myRow["Email"].ToString();
MarkTextBox.Text = myRow["SelfDescribe"].ToString(); string name = ""; PicDropDownList.Items.Clear(); string serverdir = this.Server.MapPath(".");
DirectoryInfo dir = new DirectoryInfo(serverdir + "\\face"); int i = 0; int iselectitem = 0; foreach (FileInfo f in dir.GetFiles("*.*"))
{
name = f.Name;
if (name == myRow["PictureID"].ToString().Trim())
{
iselectitem = i; }
PicDropDownList.Items.Add(name);
i++;
}
PicDropDownList.SelectedIndex = iselectitem;
Image1.ImageUrl = serverdir + "\\face\\" + PicDropDownList.SelectedItem.ToString(); }
else
{ Response.Redirect("login.aspx"); }
} protected void OKButton_Click(object sender, EventArgs e)
{
string updatesql = ""; string pic = PicDropDownList.SelectedItem.ToString(); if (NPwdTextBox.Text != "")
{
updatesql = "update [UserManager] set [UpassWord] = '" + NPwdTextBox.Text + "',[Name]='" + NameTextBox.Text
+ "',[Email]='" + EmailTextBox.Text + "',[PictureID] ='" + pic + "'where [UserID]=" + Session["UserID"].ToString();
}
else
{
updatesql = "update [UserManager] set [Name] =' " + NameTextBox.Text + "'," + "[Email]='" + EmailTextBox.Text + "',[PictureID]='"
+ pic + "' where [UserID]=" + Session["UserID"].ToString();
} localhost.Service1 myService1; myService1 = new localhost.Service1(); string strConn;
SqlConnectionStringBuilder strCnn = new SqlConnectionStringBuilder();
strCnn.DataSource = @"(local)\SQLExpress";
strCnn.InitialCatalog = "BBS";
strCnn.IntegratedSecurity = true; strConn = strCnn.ConnectionString; myService1.ExcuteNQSql(updatesql ,strConn ); Response.Redirect("success.aspx");
}
}
}
这个只能更新[UpassWord] 而且在匹配邮件格式的时候老出现错误
哪位高手指导一下
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.Sql;
using System.Data.SqlClient;
using System.IO;
using System.Data;
using System.Web.SessionState;namespace WSBBS
{
public partial class modify : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
localhost.Service1 myService1;
myService1 = new localhost.Service1(); string strConn;
SqlConnectionStringBuilder strCnn = new SqlConnectionStringBuilder();
strCnn.DataSource = @"(local)\SQLExpress";
strCnn.InitialCatalog = "BBS";
strCnn.IntegratedSecurity = true; strConn = strCnn.ConnectionString; DataSet myDS;
myDS = new DataSet(); if (Session["UserID"].ToString()!= "")
{
string strID = Session["UserID"].ToString(); string connectstring = " select * from [UserManager] where UserID =" + "'" + strID + "'"; myDS = myService1.GetsDS(connectstring, strConn); DataRow myRow = myDS.Tables[0].Rows[0]; NameTextBox.Text = myRow["name"].ToString();
EmailTextBox.Text = myRow["Email"].ToString();
MarkTextBox.Text = myRow["SelfDescribe"].ToString(); string name = ""; PicDropDownList.Items.Clear(); string serverdir = this.Server.MapPath(".");
DirectoryInfo dir = new DirectoryInfo(serverdir + "\\face"); int i = 0; int iselectitem = 0; foreach (FileInfo f in dir.GetFiles("*.*"))
{
name = f.Name;
if (name == myRow["PictureID"].ToString().Trim())
{
iselectitem = i; }
PicDropDownList.Items.Add(name);
i++;
}
PicDropDownList.SelectedIndex = iselectitem;
Image1.ImageUrl = serverdir + "\\face\\" + PicDropDownList.SelectedItem.ToString(); }
else
{ Response.Redirect("login.aspx"); }
} protected void OKButton_Click(object sender, EventArgs e)
{
string updatesql = ""; string pic = PicDropDownList.SelectedItem.ToString(); if (NPwdTextBox.Text != "")
{
updatesql = "update [UserManager] set [UpassWord] = '" + NPwdTextBox.Text + "',[Name]='" + NameTextBox.Text
+ "',[Email]='" + EmailTextBox.Text + "',[PictureID] ='" + pic + "'where [UserID]=" + Session["UserID"].ToString();
}
else
{
updatesql = "update [UserManager] set [Name] =' " + NameTextBox.Text + "'," + "[Email]='" + EmailTextBox.Text + "',[PictureID]='"
+ pic + "' where [UserID]=" + Session["UserID"].ToString();
} localhost.Service1 myService1; myService1 = new localhost.Service1(); string strConn;
SqlConnectionStringBuilder strCnn = new SqlConnectionStringBuilder();
strCnn.DataSource = @"(local)\SQLExpress";
strCnn.InitialCatalog = "BBS";
strCnn.IntegratedSecurity = true; strConn = strCnn.ConnectionString; myService1.ExcuteNQSql(updatesql ,strConn ); Response.Redirect("success.aspx");
}
}
}
这个只能更新[UpassWord] 而且在匹配邮件格式的时候老出现错误
哪位高手指导一下
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货