我已经使用SHAPE命令创建了ADO记录集。现在,如何在vb6中将数据报告文本框与结果集字段绑定?

我已经使用SHAPE命令创建了ADO记录集。现在,如何在vb6中将数据报告文本框与结果集字段绑定?,vb6,Vb6,我的记录集已成功填充ADO。但是现在如何在vb6中与数据报表的文本字段连接呢?请帮忙?我的问题如下 str = "SHAPE {select * from sale where sale_from_id='" & firmName & "' and ret_id='" & Trim(txtRetId) & "' and date >=#" & Format(dtpFrom.value, "MM-DD-YYYY")

我的记录集已成功填充ADO。但是现在如何在vb6中与数据报表的文本字段连接呢?请帮忙?我的问题如下

   str = "SHAPE {select * from sale where sale_from_id='" & firmName &
         "' and ret_id='" & Trim(txtRetId) & "' and date >=#" &
       Format(dtpFrom.value, "MM-DD-YYYY") & "# and date <= #" &
       Format(dtpTo.value, "MM-DD-YYYY") & "#}" _
                   & " APPEND ((SHAPE {select  sd.sale_id,sd.sdet_id,sd.item_id,i.item_name,sd.qty,sd.sdet_price,sd.sub_total
       from sale_detail sd, item i where i.item_id = sd.item_id}" _
                          & " APPEND({select * from sale_serial} AS sale_serial" _
                                  & " RELATE sdet_id TO sdet_id )) AS sale_detail" _
                         & " RELATE sale_id TO sale_id ) AS sale"

把代码写在这里我把代码放在这里

       InvSql = "   SHAPE {SELECT * FROM `sales`}  AS salesgroup COMPUTE  salesgroup,   COUNT(salesgroup.'units') AS Aggregate1, <br/>SUM(salesgroup.'price') AS    Aggregate2, SUM(salesgroup.'total') AS Aggregate3 BY 'mname'" 


Set invReport = New ADODB.Recordset
 invReport.Open InvSql, cn
    invReport.Requery
Set rssum = New ADODB.Recordset
sumSql = "select amount  from credit where billno='BL001'"
rssum.Open sumSql, cn
rssum.Requery
 rptdealer.Sections("Section5").Controls.Item("Label5").Caption = "Rs." & rssum(0).Value
    Set rptdealer.DataSource = invReport
rptdealer.Show

 goto report page and insert group footer and group header place ur texbox and lables
get into code behind page of report page 

Private Sub DataReport_Initialize()
On Error Resume Next
   Move 0, 0
   Me.Caption = "Invoice Report"
   Me.Width = 11600
   Me.Height = 9000
   Me.ReportWidth = 8520
   Me.BottomMargin = 1440
   Me.TopMargin = 1440
   Me.LeftMargin = 1440
   Me.RightMargin = 1440
  SetSection6
End Sub
Private Sub SetSection6() 'parent credit
  Sections("Section6").Controls("txtbillno").DataField = "mname"
End Sub

 for other controls place controls and in datafield five the column name in database 
<strong>thats it now run !!!</strong>

当提供一个包含代码的答案时,通常最好解释一下您所做的事情以及它为什么工作。
       InvSql = "   SHAPE {SELECT * FROM `sales`}  AS salesgroup COMPUTE  salesgroup,   COUNT(salesgroup.'units') AS Aggregate1, <br/>SUM(salesgroup.'price') AS    Aggregate2, SUM(salesgroup.'total') AS Aggregate3 BY 'mname'" 


Set invReport = New ADODB.Recordset
 invReport.Open InvSql, cn
    invReport.Requery
Set rssum = New ADODB.Recordset
sumSql = "select amount  from credit where billno='BL001'"
rssum.Open sumSql, cn
rssum.Requery
 rptdealer.Sections("Section5").Controls.Item("Label5").Caption = "Rs." & rssum(0).Value
    Set rptdealer.DataSource = invReport
rptdealer.Show

 goto report page and insert group footer and group header place ur texbox and lables
get into code behind page of report page 

Private Sub DataReport_Initialize()
On Error Resume Next
   Move 0, 0
   Me.Caption = "Invoice Report"
   Me.Width = 11600
   Me.Height = 9000
   Me.ReportWidth = 8520
   Me.BottomMargin = 1440
   Me.TopMargin = 1440
   Me.LeftMargin = 1440
   Me.RightMargin = 1440
  SetSection6
End Sub
Private Sub SetSection6() 'parent credit
  Sections("Section6").Controls("txtbillno").DataField = "mname"
End Sub

 for other controls place controls and in datafield five the column name in database 
<strong>thats it now run !!!</strong>