protected void Button1_Click(object sender, EventArgs e) { string account = this.TextBox_Account.Text.Trim(); string password = this.TextBox_Password.Text.Trim(); string password1 = this.TextBox_Password1.Text.Trim(); string nickname = this.TextBox_Nickname.Text.Trim(); string city = this.ddlcity.SelectedItem.Text; string area = this.ddlarea.SelectedItem.Text; string address = this.TextBox_Address.Text.Trim(); string email = this.TextBox_Email.Text.Trim(); string phone = this.TextBox_Phone.Text.Trim(); string birthday = ddlBirthday.SelectedItem + "/" + this.Calendar1.SelectedDate.Month.ToString() + "/" + this.Calendar1.SelectedDate.Day.ToString(); string Max = "0"; if (account == "" || password == "" || nickname == "" || address == "" || email == "" || phone == "" || birthday == "") { this.Label_Message.Text = "欄位不可空白"; return; } if (password != password1) { this.Label_Message.Text = "確認密碼不同"; return; } string str = "Select * from 會員基本資料表 where 帳號 ='" + account + "'"; DataTable timeDt = new DataTable(); timeDt = conns.LoadTable_SQL(str, ""); if (timeDt.Rows.Count > 0) { Label_Message.Text = "此帳號已被使用"; return; } string salt = "ABCD"; //原輸入密碼1234加上salt字串,再進行加密動作 password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password + salt, "sha1"); address = city + "," + area + "," + address; string sqlStr = " Insert into 會員基本資料表 values ('" + account + "','" + password + "','" + nickname + "','" + Max + "','" + address + "','" + email + "','" + phone + "','" + birthday + "')"; string rtnMsg; rtnMsg = conns.RunSqlStr(sqlStr, ""); if (rtnMsg == "Success") { this.Label_Message.Text = "申請會員成功"; this.Button_Send.Text = "會員登入"; Response.Redirect("Login.aspx"); } else { this.Label_Message.Text = "申請會員失敗"; } }
public DataTable HotLink() { ConnDB conns = new ConnDB(); string str = "select CONVERT(varchar,CAST(Idnumber AS decimal(2, 0))-10)+ '.'+Title as title from HotLink where type='SuggestWeb'"; DataTable dt = new DataTable(); dt = conns.LoadTable_SQL(str, ""); return(dt); }
public DataTable Arealist(string Counties) { ConnDB conns = new ConnDB(); string str = "select Area from City a inner join Area b on a.AqrefNbr=b.AqrefNbr where Counties ='" + Counties + "'"; DataTable dt = new DataTable(); dt = conns.LoadTable_SQL(str, ""); return(dt); }
public DataTable Citylist() { ConnDB conns = new ConnDB(); string str = "select Counties from City"; DataTable dt = new DataTable(); dt = conns.LoadTable_SQL(str, ""); return(dt); }
public string getNikebyName(string Name) { ConnDB conns = new ConnDB(); string str = "select * from 會員基本資料表 where 帳號='" + Name + "'"; DataTable dt = new DataTable(); dt = conns.LoadTable_SQL(str, ""); str = dt.Rows[0]["暱稱"].ToString(); return(str); }
public string getHotlinkcnt() { ConnDB conns = new ConnDB(); string str = "select COUNT(*) as 總數 from HotLink where type in('SuggestWeb','Hot') "; DataTable dt = new DataTable(); dt = conns.LoadTable_SQL(str, ""); string cnt = dt.Rows[0]["總數"].ToString(); return(cnt); }
protected void Page_Load(object sender, EventArgs e) { DataTable dt = new DataTable(); string sqlStr = "Select 公告種類,公告內容,發表日期 from 公告"; ConnDB conns = new ConnDB(); dt = conns.LoadTable_SQL(sqlStr, ""); GridView1.DataSource = dt; GridView1.DataBind(); }