这是我使用 sql 查询分析器的工作 sql 语法,它显示我想要的记录
SELECT OE_Category, OE_ID
FROM tblOfficeEquipmentProfile
WHERE (OE_ID = 'dxdxdx')
在将它用于 vb.net 时:
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 New SqlCommand
sqlconn.Open()
Dim da As New SqlDataAdapter("SELECT OE_Category, OE_ID FROM tblOfficeEquipmentProfile WHERE OE_ID = '" & txtOEID.Text & "'", sqlconn)
Dim dt As New DataTable
da.Fill(dt)
cmbCategory.DataSource = dt
cmbCategory.ValueMember = "CAT_ID"
cmbCategory.DisplayMember = "CAT_Name"
sqlconn.Close()
End Sub
发生错误:
无法绑定到新的显示成员。