vb.net中的内连接sql语法不返回任何错误,但也不返回任何结果

时间:2013-04-16 06:14:34

标签: sql sql-server vb.net join

两个表

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

0 个答案:

没有答案