用户登陆:
设为首页 | 加入收藏 | 免费邮箱
建站学院: 建站心得 | 搜索优化 | 建站点子 | 网站推广 | 网站推荐 | 企业新闻 | 人物新闻 | 网媒内幕 | 域名相关 | 热门专题 | 本站作品
设计学院: 网页设计 | 平面设计 | 网络编程 | 多媒体类 | 数据库类 | 服务器类 | 操作系统 | 联盟新闻 | 联盟介绍 | 联盟点评 | 网赚技巧
模板下载: 旅游度假 | 饮食食品 | 公司展示 | 学校教育 | 文化艺术 | 金融财经 | 儿童卡通 | 体育运动 | 服饰品牌 | 爱情交友 | 游戏娱乐
您现在的位置: 星星雨设计站 >> 设计学院 >> 网络编程 >> NET编程 >> 教程正文
一个简单的用户登陆程序……
作者:佚名    教程来源:不详    点击数:    更新时间:2007-11-19

Content-Type: Text/Plain; charset="gb2312"
Content-Transfer-Encoding: 8bit

以下程序是用来验证用户登录的共有两个按钮,一个是用来提交的,一个是用来重填的,页面部分就很简单了,两个文本框,两个按钮,这里页面的代码就不写了:)

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If TextBox3.Text = "" Or TextBox4.Text = "" Then
            Label35.Text = "请确认您的输入!"
            Return
        End If
        Dim sql As String = "select * from pwd where stu_id=@stu_id and pwd=@pwd"
        Dim comm As SqlCommand = New SqlCommand(sql, conn)
        comm.Parameters.Add(New SqlParameter("@stu_id", SqlDbType.Int, 4))
       comm.Parameters("@stu_id").Value = TextBox3.Text
        comm.Parameters.Add(New SqlParameter("@pwd", SqlDbType.Char, 16))
        comm.Parameters("@pwd").Value = TextBox4.Text
        Dim dr As SqlDataReader
        conn.Open()
        dr = comm.ExecuteReader
        If dr.Read Then
            Session("stu_id") = TextBox3.Text
            dr.Close()
            comm.Cancel()
            Dim sql_3 As String = "update stu_base set point=point+1 where stu_id=@stu_id"
            comm = New SqlCommand(sql_3, conn)
            comm.Parameters.Add(New SqlParameter("@stu_id", SqlDbType.Int, 4))
            comm.Parameters("@stu_id").Value = Session("stu_id")
           comm.ExecuteNonQuery()
            comm.Cancel()
            Response.Redirect("detail.aspx?stu_id='" & Session("stu_id") & "'")
        Else
            Label35.Text = "您还没有注册或账号密码错误"
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
    End Sub 


发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口教程录入:冰河    责任编辑:冰河 
  网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
最新热门
最新推荐
| 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明