dim Rs as adodb.recordset
command.commandtext=Sql
set rs=command.excute
set datareport.datasource=rs

解决方案 »

  1.   

    PrintGrid打印预览控件,可以解决
    http://easyprint.vip.myrice.com/
      

  2.   

    可以在command属性的数据源的SQL语句框中输入查询语句,其中的条件字段的值
    写为?,值在程序中赋给
    例:SQL语句为 
    select * from table1 where number=? and time  between  ? and ?DataEnvironment1.Connection1.Open
    DataEnvironment1.Command1 Text1.Text, strStarttime, strEndtime
    Set DataReport1.DataSource = DataEnvironment1
    DataReport1.Show 
    DataEnvironment1.Connection1.Close
      

  3.   

    http://expert.csdn.net/Expert/topic/1140/1140533.xml?temp=.9570429
      

  4.   

    一个很好的打印预览控件很多企业都用它。
    easyprint.vip.myrice.com