Private Sub Button _Click(ByVal sender As System Object ByVal e As System EventArgs) Handles Button Click
创新互联专注于仲巴企业网站建设,自适应网站建设,购物商城网站建设。仲巴网站建设公司,为仲巴等地区提供建站服务。全流程定制开发,专业设计,全程项目跟踪,创新互联专业和态度为您提供的服务
If TextBox Text = Or TextBox Text = Then
Label Text = 请确认您的输入!
Return
End If
Dim sql As String = select * from pwd where stu_id=@stu_id and pwd=@pwd
Dim m As SqlCommand = New SqlCommand(sql conn)
m Parameters Add(New SqlParameter( @stu_id SqlDbType Int ))
m Parameters( @stu_id ) Value = TextBox Text
m Parameters Add(New SqlParameter( @pwd SqlDbType Char ))
m Parameters( @pwd ) Value = TextBox Text
Dim dr As SqlDataReader
conn Open()
dr = m ExecuteReader
If dr Read Then
Session( stu_id ) = TextBox Text
dr Close()
m Cancel()
Dim sql_ As String = update stu_base set point=point+ where stu_id=@stu_id
m = New SqlCommand(sql_ conn)
m Parameters Add(New SqlParameter( @stu_id SqlDbType Int ))
m Parameters( @stu_id ) Value = Session( stu_id )
m ExecuteNonQuery()
m Cancel()
Response Redirect( detail aspx?stu_id= Session( stu_id ) )
Else
Label Text = 您还没有注册或账号密码错误
End If
End Sub
Private Sub Button _Click(ByVal sender As System Object ByVal e As System EventArgs) Handles Button Click
TextBox Text =
TextBox Text =
lishixinzhi/Article/program/net/201311/13960
哈哈简单哪
第一步:登陆网页代码
第二步:登陆以后判断是否登陆成功
有两种方法:1.获取网页代码,判断网页字符有无”登陆成功”字样
源代码:
2.就是判断网页是否跳转到了某一页
源代码:
两种方法结合起来用,可以判断网页是否无法连接
你每次取出的是表中的首条记录,当然只能用首条记录登陆了!
Dim name, password As String
name = TextBox1.Text
Dim com As New OleDb.OleDbCommand("select * from denglu where name='" name "'", conn)
Dim dr As OleDb.OleDbDataReader
conn.Open()
dr = com.ExecuteReader
dr.Read()
password = dr.GetString(1)
If TextBox3.Text = password Then
mesbox("成功!")
Else
msgbox("失败")
End If
dr.Close()
conn.Close()
这种情况下,效率极不好!你能理解什么意思就行了!否则将你的程序改完了!
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控件
}
Cookie丢了
登陆的时候,把CookieContainer保存下来,可以设置一个全局变量,然后再getBody的时候,
request.Cookiecontainer设置为这个CookieContainer即可