Private Sub SendBlogTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SendBlogTimer.Tick
創新互聯建站服務項目包括東興網站建設、東興網站制作、東興網頁制作以及東興網絡營銷策劃等。多年來,我們專注于互聯網行業,利用自身積累的技術優勢、行業經驗、深度合作伙伴關系等,向廣大中小型企業、政府機構等提供互聯網行業的解決方案,東興網站推廣取得了明顯的社會效益與經濟效益。目前,我們服務的客戶以成都為中心已經輻射到東興省份的部分城市,未來相信會繼續擴大服務區域并繼續獲得客戶的支持與信任!
Dim textboxUserId As HtmlElement
Dim textboxPassword As HtmlElement
Dim buttonSubmit As HtmlElement
textboxUserId = SendBlogBrowser.Document.All("username")'獲取用戶名輸入框
textboxPassword = SendBlogBrowser.Document.All("password")'獲取密碼輸入框
buttonSubmit = SendBlogBrowser.Document.All("btnLogin")'獲取登陸按鈕
textboxUserId.SetAttribute("value","用戶名")'給用戶名輸入框賦值
textboxPassword.SetAttribute("value","密碼")'給密碼框賦值
buttonSubmit.InvokeMember("click")’執行登陸按鈕的單擊
End Sub
其中的SendBlogBrowser為WebBrowser控件
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text == "" || TextBox2.Text == "")
{
Response.Write("scriptalert('用戶名或密碼不能為空!')/script"); //提示對話框
}
else
{
string ConStr = "server=(local);user id=sa;pwd=123456;database=userdb";
SqlConnection con = new SqlConnection(ConStr);
string SqlStr = "select * from mymember where sname = '" + TextBox1.Text + "' and spwd = '" + TextBox2.Text + "'"; //Select查詢語句
SqlDataAdapter ada = new SqlDataAdapter(SqlStr, con);
con.Open(); //打開連接
DataSet ds = new DataSet();
ada.Fill(ds);
if (ds.Tables[0].Rows.Count 0)
{
Session["username"] = TextBox1.Text;
Response.Redirect("index.aspx");
}
else
{
Response.Write("scriptalert('用戶名或密碼錯誤,請重新登錄!')/script");
}
} //綁定GridView控件
}
select * from t1 where name=** and password=** and style=**
如果查詢到的表是空的,說明登陸錯誤,否則成功