Imports System.IO Imports System.Data.OleDb Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Session("Login") = False DropDownList4.SelectedIndex = DropDownList4.Items.Count - 1 End Sub Protected Sub Submit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Session("Path") = Server.MapPath(String.Format("{0}\{1}\{2}.mdb", DropDownList4.SelectedValue, DropDownList1.SelectedValue, DropDownList2.SelectedValue)) If txtID.Text.Trim() <> "" AndAlso File.Exists(Session("Path")) Then Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=" & Session("Path")) Dim cmd As New OleDbCommand(String.Format("select * from {0} where Field1='{1}'", DropDownList3.SelectedValue, txtID.Text), conn) conn.Open() Dim dr As OleDbDataReader = cmd.ExecuteReader(Data.CommandBehavior.CloseConnection) If dr.HasRows Then Session("ID") = txtID.Text Session("Login") = True Session("Level") = DropDownList3.SelectedValue Response.Redirect("Result.aspx") End If conn.Close() End If txtID.Text = "" txtID.Focus() End Sub Protected Sub Change(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged DropDownList2.Items.Clear() Select Case DropDownList1.SelectedIndex Case 0 DropDownList2.Items.Add(New ListItem("علوم الحاسوب", "Computer Science")) DropDownList2.Items.Add(New ListItem("أنظمة معلومات حاسوبية", "Computer Information System")) DropDownList2.Items.Add(New ListItem("تجارة إلكترونية", "Ecommerce")) Case 1 DropDownList2.Items.Add(New ListItem("المحاسبة", "Accounting")) DropDownList2.Items.Add(New ListItem("إدارة أعمال", "Management")) Case 2 DropDownList2.Items.Add(New ListItem("اللغة الإنجليزية", "English")) Case 3 DropDownList2.Items.Add(New ListItem("شريعة", "Law")) Case 4 DropDownList2.Items.Add(New ListItem("علوم الحاسوب", "Computer Science")) DropDownList2.Items.Add(New ListItem("اللغة الإنجليزية", "English")) DropDownList2.Items.Add(New ListItem("دراسات إسلامية", "Islamic Studies")) End Select End Sub End Class