【问题标题】:How to view all data master table of specific column from another table of column where relationship in access database using vb.net 2019如何使用vb.net 2019从访问数据库中关系的另一个列表中查看特定列的所有数据主表
【发布时间】:2020-01-29 09:11:56
【问题描述】:

这是我在 SQL 查询中的问题,结果已成功加载数据网格中的数据,如 SL_No (2,4,5),但表 Pairing 中缺少一些数据,如 (1,2,3,4,5 ,6) 其中关系表数据不可用,例如Receipt 表中的 (1,3,6)。

Private Sub BtnView_Click(sender As Object, e As EventArgs) Handles btnView.Click

    Dim Sql as String = "Select Pairing.Ledger_Index, Pairing.Fr_Customer_no, Pairing.Fr_Customer_nm, Receipt.Dt_Entry, Receipt.Price from Pairing INNER JOIN Receipt ON Pairing.Fr_Customer_no = Receipt.Sub_No WHERE (((Pairing.Ledger_Address)='" & cmbList.Text & "'))""

    If RdoLedger.Checked=True Then
       DatagridView_Load("sql",DatagridView1)
    End If

End Sub

Public Function DatagridView_Load(ByVal Sql As String, ByVal Model As DataGridView)
    Try
        If con.State = ConnectionState.Open Then
            con.Close()
        End If
        Model.DataSource = Nothing
        Dim da As New OleDbDataAdapter(Sql, con)
        Dim dt As New DataTable
        dt.Clear()
        da.Fill(dt)
        If IsDBNull(dt) = False Then
            Model.DataSource = (dt)
            con.Close()
        Else
            Model.DataSource = Nothing
            con.Close()
        End If

    Catch ex As Exception
        MsgBox("ERROR : " & ex.Message.ToString)
    End Try
    Return True
End Function

【问题讨论】:

    标签: sql vb.net ms-access-2007 visual-studio-2019


    【解决方案1】:

    谢谢你没有身体回复我,因为我不会理解这个问题的答案。这是一些简单的答案。在这里,我想要第一张桌子的所有记录。 所以我的查询应该是= from Pairing INNER JOIN Receipt 更改为 from Pairingleft JOIN Receipt 它成功地得到了我的结果

    【讨论】:

    • 您可以接受自己的答案。您不会获得积分,但它会对未来的读者有所帮助。
    猜你喜欢
    • 2012-11-07
    • 1970-01-01
    • 2019-07-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-31
    • 2019-08-13
    • 2014-03-08
    相关资源
    最近更新 更多