linq to sql网格视图

时间:2015-06-03 19:53:02

标签: vb.net

我制作销售和采购系统,当我查询或查询发票编号时,结果显示在棕榈树视图中,但只显示在一行,而帐单不超过一行 这是代码使用的 我使用vb.net和数据库sql和b yway linq到sql

 Try
        Dim data = (From d In DBVariable.Data.masterfatoras 
                    From f In DBVariable.Data.fatoras
                    From na In DBVariable.Data.asnafs 
                    From sup In DBVariable.Data.suppliers
                    Where d.ID = f.mid Where d.num.Contains(txt)
                    Select d, f, na, sup).FirstOrDefault
        TextBoxX1.Text = data.d.num


        nammord.Text = (From supp In DBVariable.Data.suppliers Where data.d.idmord = supp.ID Select supp.Name).Single()
        txtmord.Text = (From supp In DBVariable.Data.suppliers Where data.d.idmord = supp.ID Select supp.Code).Single()
        adrmord.Text = (From supp In DBVariable.Data.suppliers Where data.d.idmord = supp.ID Select supp.Address).Single()
        nodaf.Text = data.d.nodfa
        ' ''نفاصيل الفاتورة


        For p As Integer = 0 To gridshraa.Rows.Count - 1

            gridshraa.Rows(p).Cells(2).Value = (From asna In DBVariable.Data.asnafs Where data.f.idname = asna.ID Select asna.Name).Single()
            gridshraa.Rows(p).Cells(1).Value = (From asna In DBVariable.Data.asnafs Where data.f.idname = asna.ID Select asna.code).Single()
            gridshraa.Rows(p).Cells(3).Value = (From asna In DBVariable.Data.asnafs Where data.f.idname = asna.ID Select asna.unit).Single()
            gridshraa.Rows(p).Cells(4).Value = data.f.qty
            gridshraa.Rows(p).Cells(5).Value = data.f.price
            gridshraa.Rows(p).Cells(6).Value = data.f.totprice
        Next

    Catch

    End Try

0 个答案:

没有答案