VB.NET Menambahkan 2 DataAdapter kedalam 1 DataSet

Posted On // Leave a Comment
Dim dataSetSublet As New DataSet
        Dim dataAdapterSubletHeader As SqlDataAdapter = New SqlDataAdapter("SELECT ID,Nama FROM OPQHeader", _SqlConnection) 'Tanggal,Nomor,PONomor,PKBNomor FROM sblPembelian", _SqlConnection)
        Dim dataAdapterSubletDetail As SqlDataAdapter = New SqlDataAdapter("SELECT HeaderID,Nama FROM OPQDetail", _SqlConnection) ',Baris,SubletID,Kuantitas,HargaSatuan FROM sblPembelianDetail", _SqlConnection)

        dataAdapterSubletHeader.Fill(dataSetSublet, "Header")
        dataAdapterSubletDetail.Fill(dataSetSublet, "Detail")

        Dim KeyColumnNomor As DataColumn = dataSetSublet.Tables("Header").Columns("ID")
        Dim KeyForeignColumnNomor As DataColumn = dataSetSublet.Tables("Detail").Columns("HeaderID")
        dataSetSublet.Relations.Add("RelationSubletMasterDetail", KeyColumnNomor, KeyForeignColumnNomor, False)

        GridControl1.DataSource = dataSetSublet.Tables("Header")
        CardView1.PopulateColumns(dataSetSublet.Tables("Detail"))

0 komentar: