这样的代码如何与数据库相联?
Namespace aspx
Partial Class UserLogin
Inherits System.Web.UI.Page
#Region " Web 窗体设计器生成的代码 "
'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
'注意: 以下占位符声明是 Web 窗体设计器所必需的。
'不要删除或移动它。
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub
#End Region
Dim sqlstr As New aspx.sqllangue.sqllangue
Dim sqlselect As String
Private Sub errorshow()
If Me.Session("error") <> "" Then
Me.Response.Write(Me.Session("error"))
Me.Response.End()
End If
End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
sqlstr.conns()
errorshow()
If Me.CheckBox1.Checked = True Then
sqlselect = "select pwd,name,power,id from useradmin where username='" & Me.Textbox2.Text & "'"
sqlstr.sqlselect(sqlselect)
errorshow()
If sqlstr.sqlds.Tables("temporary").Rows.Count = 0 Then
Me.Label1.Text = "用户不存在!"
Else
If RTrim(sqlstr.sqlds.Tables("temporary").Rows(0).Item(0)) = Me.Textbox3.Text Then
Me.Session("adminno") = Me.Textbox2.Text
Me.Session("adminname") = sqlstr.sqlds.Tables("temporary").Rows(0).Item(1)
Me.Session("adminpower") = sqlstr.sqlds.Tables("temporary").Rows(0).Item(2)
Me.Session("adminid") = sqlstr.sqlds.Tables("temporary").Rows(0).Item(3)
Me.Session("userno") = ""
Me.Session("username") = ""
Me.Session("userid") = ""
If Me.Session("adminpower") = -1 Then
Response.Redirect("adminbar.aspx")
Else
Response.Redirect("toolbar.aspx")
End If
Else
Me.Label1.Text = "密码错误"
End If
End If
图片传不上去
就贴原码了!
谢谢