0

我将此代码用于两个表连接并显示到 DataGridView

Dim strSQL4 

strSQL4 = " Select Regno, Sname,Class, Section,SUM(FeeAmount) as FeeAmount FROM FeesMaster WHERE class='" & cboClass.Text & "'  GROUP By Regno,Sname,Class,Section"

strSQL5 = " Select Regno, ST_Name,Class, Section,SUM(Amount_Paid) as Amount_Paid FROM Fees_Transaction WHERE class='" & cboClass.Text & "'  GROUP By Regno,ST_Name,Class,Section"

Dim DaAp4 As New SqlDataAdapter(strSQL4, con)
Dim DSet4 As New DataTable
DaAp4.Fill(DSet4)
DataGridView2.DataSource = DSet4.DefaultView
4

1 回答 1

0

在您上面的代码中,您实际上并没有对 strSQL5 做任何事情,那么您希望它如何出现在 DGV 上?

正如@xfx 建议的那样,您应该调整 strSQL4 以便它使用 strSQL5 中的 SQL 作为 JOIN。

于 2013-01-24T18:40:28.747 回答