日期:2014-05-18  浏览次数:20493 次

大家帮我看看,登陆代码?
刚学.net呀!哈哈!
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
  '创建数据库链接
  Dim sqlconn As SqlConnection
  Dim strconn As String
  strconn = "data source=yh;initial catalog=admin;user id=sa;password=sql2005"
  sqlconn = New SqlConnection(strconn)
  sqlconn.Open()

  '创建command对象
  Dim sqlcmd As New SqlCommand
  sqlcmd.Connection = sqlconn
  sqlcmd.CommandType = Data.CommandType.Text
  sqlcmd.CommandText = "selet Name,Password from admininfo where [Name] = '" + TextBox1.Text + "' And [Password] = '" + TextBox2.Text + "'"

  '创建datareader对象
  Dim sqldr As SqlDataReader
  sqldr = sqlcmd.ExecuteReader

  Dim i As Integer = sqlcmd.ExecuteNonQuery
  If i <> 1 Then
  Response.Redirect("Register.aspx")
  End If
  End Sub
“/Login”应用程序中的服务器错误。
--------------------------------------------

关键字 'from' 附近有语法错误。
先谢谢了!!!!!

------解决方案--------------------
"select Name,Password from admininfo where [Name] = '" + TextBox1.Text + "' And [Password] = '" + TextBox2.Text + "'" 

是select拼写错误

------解决方案--------------------
是select拼写错误

晕死!!!!!!!!
------解决方案--------------------
呵呵。。。。。。
初学都会有过。。。