0% found this document useful (0 votes)
17 views

Code For First Page: Imports Partial Class Inherits Protected Sub Byval As Object Byval As Handles Dim New

The document contains code for three ASP.NET web forms pages - a login page, registration page, and approval page - that access a Microsoft Access database called "myDb.mdb". The login page validates a user's credentials against the database. The registration page inserts a new user record into the database. The approval page updates an existing user record in the database to mark it as approved.

Uploaded by

anon-788714
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Code For First Page: Imports Partial Class Inherits Protected Sub Byval As Object Byval As Handles Dim New

The document contains code for three ASP.NET web forms pages - a login page, registration page, and approval page - that access a Microsoft Access database called "myDb.mdb". The login page validates a user's credentials against the database. The registration page inserts a new user record into the database. The approval page updates an existing user record in the database to mark it as approved.

Uploaded by

anon-788714
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

CODE FOR FIRST PAGE

Imports System.Data.OleDb

Partial Class _Default


Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim dbconn, sql, dbcomm, dbread
dbconn = New
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" &
Server.MapPath("myDb.mdb"))
dbconn.Open()
sql = "SELECT * FROM login where username = '" + TextBox1.Text
+ "' and password = '" + TextBox2.Text + "'"
dbcomm = New OleDbCommand(sql, dbconn)
dbread = dbcomm.ExecuteReader()
If (Not dbread.read()) Then
Label1.Text = "Not "
Else
Response.Redirect("register.aspx")
End If
End Sub
End Class

CODE for REGISTER PAGE

Imports System.Data.OleDb
Partial Class register
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Me.Load

End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Button1.Click

Dim dbconn, sql, dbcomm, Raw ', dbread


dbconn = New
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" &
Server.MapPath("myDb.mdb"))
dbconn.Open()
sql = "INSERT INTO register values('" + TextBox1.Text + "'," +
TextBox2.Text + ",0)"
Response.Write(sql)
dbcomm = New OleDbCommand(sql, dbconn)
Raw = dbcomm.ExecuteNonQuery()
End Sub
End Class
Code For APPROVE PAGE

Imports System.Data.OleDb

Partial Class approve


Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As


System.EventArgs) Handles Me.Load
Dim dbconn, sql, dbcomm
dbconn = New
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" &
Server.MapPath("myDb.mdb"))
dbconn.Open()
sql = "UPDATE register set approved =1 where name ='" &
Request.QueryString("id") & "'"
dbcomm = New OleDbCommand(sql, dbconn)
dbcomm.ExecuteNonQuery()
Label1.Text = Request.QueryString("id") & " is Approved"
End Sub
End Class

You might also like