Imports System.Data Imports System.Data.OleDb Partial Class EVLove Inherits System.Web.UI.Page Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim tk_provider = "Provider=Microsoft.ACE.OLEDB.12.0" Dim tk_database = "Data Source=" & Server.MapPath("NumerologyDB.accdb") Dim tk_conn As New OleDbConnection(tk_provider & ";" & tk_database) Dim tk_sql As String Dim tk_cmd As OleDbCommand tk_conn.Open() tk_sql = "SELECT 對象陰陽五行,主角陰陽五行,直接來電 FROM 直接來電" Dim DtApter As OleDbDataAdapter = New OleDbDataAdapter(tk_sql, tk_conn) Dim DtSet As DataSet = New DataSet DtApter.Fill(DtSet, "table01") Dim m_tb1 As DataTable m_tb1 = DtSet.Tables("table01") 'Response.Write(m_tb1.Rows.Count) Dim i As Integer Dim iScore As Integer For i = 0 To m_tb1.Rows.Count - 1 If m_tb1.Rows(i).Item(0) = DropDownList1.Text And m_tb1.Rows(i).Item(1) = DropDownList2.Text Then iScore = CInt(m_tb1.Rows(i).Item(2)) Exit For End If Next Label1.Text = iScore.ToString() tk_conn.Close() End Sub End Class