这是一段vb.net代码,想实现登录的功能,调试没错,但是一运行就会出错,大家帮我看看啊!!
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myconn As New clssql
Dim username As String = ""
Dim userpassword As String = ""
Dim myda As SqlDataAdapter = New SqlDataAdapter("select * from 用户信息表 where u_name='" & username & "'and u_password ='" & userpassword & "' ", myconn.sqlperate)
Dim myds As New DataSet
Dim mytable As New DataTable
myconn.sqlperate.Open()
myda.Fill(myds)
myda.Fill(mytable)
myconn.sqlperate.Close()
Dim i As Integer
For i = 0 To mytable.Rows.Count
username = mytable.Rows.Item(i).ToString
If TextBox1.Text <> username Then '判断用户是否存在
Continue For
Else
Me.Response.Redirect("index.aspx")
End If
Next
End Sub
这是一段vb.net代码,想实现登录的功能,调试没错,但是一运行就会出错,大家帮我看看啊!!