'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents txtusername As System.Web.UI.WebControls.TextBox
Protected WithEvents txtpassword As System.Web.UI.WebControls.TextBox
Protected WithEvents btnlogin As System.Web.UI.WebControls.Button
Protected WithEvents lblerror As System.Web.UI.WebControls.Label
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub btnlogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlogin.Click
Dim myconn As New OleDbConnection _
("Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source=" & Server.MapPath("a.mdb"))
myconn.Open()
Dim mycommand As New OleDbCommand("Select count(*) From memberTable" & _
"where memuser='" & txtusername.Text & "','" & _
"and mempass='" & txtpassword.Text & "'", myconn)
Dim CR As Integer = mycommand.ExecuteScalar()
myconn.Close()
If CR >= 1 Then
Me.Response.Redirect("member.aspx")
Else
lblerror.Text = "Please Login Again ....!"
End If
End Sub
end class
ผมใช้ VB.net 2003 เขียนนะครับเวลารันแล้วมัน error ที่บรรทัด
Dim CR As Integer = mycommand.ExecuteScalar() ช่วยดูที่หรือว่าต้องเขียนแบบอื่น
พอดีพึ่งศึกษารบกวนด้วยครับ