在执行查询时面临问题

时间:2011-04-29 16:27:28

标签: asp.net database vb.net authentication

  

可能重复:
  facing problem while executing vb.net query

我正在尝试从后端获取密码验证,并登录到该页面,但我无法执行此操作。我的疑问是:

    Dim con As SqlConnection
    con = New SqlConnection("server=chinna; uid=XXXXXX; pwd=XXXXXXX; database=self")
    con.Open()
    Dim cmd As SqlCommand
    cmd = New SqlCommand("select PASSWORD from employees where EmployeeNumber=@param", con)
    cmd.Parameters.AddWithValue("param", TextBox1.Text)
    Dim rdr As SqlDataReader
    rdr = cmd.ExecuteReader

    If TextBox2.Text = rdr.ToString() then
        Response.Redirect("default.aspx")
    Else
        MsgBox("incorrect password")

0 个答案:

没有答案