两个表
tblOfficeEquipmentCategory
-CAT_ID
-CAT_Name
tblOfficeEquipmentProfile
-OE_ID
我想要发生的是根据SAVED记录显示相应的类别 通过OE_ID检查数据库
Public Sub DisplayCategory()
'based on oe_id
Dim sqlconn As New SqlClient.SqlConnection
sqlconn.ConnectionString = "server = SKPI-APPS1;" & _
"Database = EOEMS;integrated security=true"
Dim sqlcommand As SqlCommand
sqlconn.Open()
Dim da As New SqlDataAdapter("SELECT tblOfficeEquipmentCategory.CAT_ID, tblOfficeEquipmentCategory.CAT_Name FROM tblOfficeEquipmentCategory INNER JOIN tblOfficeEquipmentProfile ON tblOfficeEquipmentCategory.CAT_ID=tblOfficeEquipmentProfile.OE_ID WHERE OE_ID = '" & txtOEID.Text & "'", sqlconn)
Dim dt As New DataTable
da.Fill(dt)
cmbCategory.DataSource = dt
cmbCategory.ValueMember = "CAT_Name"
cmbCategory.DisplayMember = "CAT_ID"
sqlconn.Close()
End Sub