Imports System.Data Imports System.Data.OleDb Partial Class SLog Inherits System.Web.UI.Page Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click '使用資料庫驅動程式的名稱 Dim tk_provider = "Provider=Microsoft.ACE.OLEDB.12.0" '資料庫所在的路徑 Dim tk_database = "Data Source=" & Server.MapPath("ShopDB.accdb") Dim tk_conn As New OleDbConnection(tk_provider & ";" & tk_database) Dim tk_sql As String Dim tk_data As String Dim tk_datareader As OleDbDataReader tk_sql = "SELECT 密碼 FROM(會員資料表) WHERE((帳號 = '" & TextBox1.Text & "'))" tk_conn.Open() Dim tk_cmd As New OleDbCommand(tk_sql, tk_conn) tk_datareader = tk_cmd.ExecuteReader() Label1.Text = "" If tk_datareader.Read() = True Then If TextBox2.Text = tk_datareader.Item(0) Then Label1.Text = TextBox1.Text & " 歡迎光臨!" Else Label1.Text = "密碼錯誤!" End If Else Label1.Text = "帳號不存在!" End If tk_datareader.Close() tk_conn.Close() End Sub End Class