Data Reports

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • swagata
    New Member
    • Sep 2006
    • 5

    Data Reports

    Hi..

    I have a problem in Data Reports in VB 6.0...

    I am creating the data report via data environment. I have written the following query in sql builder in the properties dialog box of connection object

    "Select empid,empname from param1 where Bookno=param2"

    where param1 and param2 are variables that I want to pass to the Data report -

    param1 is the tablename that I obtain from combo box on the form and param2 is the value that I obtain from textbox on the form...

    Depending on these 2 values I want to display the data report


    I am not able to do so....

    Please help me out

    Thanks

    Swagata
  • deepakpb
    New Member
    • Sep 2006
    • 5

    #2
    you have to write the code in the form from where u want to take the printouts first write the query in the command object SQL Statments(using any value of param1 and param2) and then make a report. now while calling that report befor that u have to write the following command
    Dataenvironment name is Dtenv1
    u r using the first command
    then
    Dtenv1.Commands (1).CommandType = adCmdText
    sql="select empid,empname from" & param1 & " where Bookno=" & param2
    (if param2 is integer)
    sql="select empid,empname from" & param1 & " where Bookno='" & param2 & "'"
    (if param2 is string)
    Dtenv1.Commands (1).Execute
    Dtenv1.Recordse ts(1).Open
    If Dtenv1.rsComman d1.RecordCount >= 1 Then
    datreport1.prin treport
    end if

    The above code will surel work
    bye

    Comment

    • saheer85
      New Member
      • Aug 2007
      • 1

      #3
      please can i have more details about conection to a db and all that please

      and another thing, how will will configure the parameters in the report environment itself or is there no configuration that needs to be done?

      thx

      Originally posted by deepakpb
      you have to write the code in the form from where u want to take the printouts first write the query in the command object SQL Statments(using any value of param1 and param2) and then make a report. now while calling that report befor that u have to write the following command
      Dataenvironment name is Dtenv1
      u r using the first command
      then
      Dtenv1.Commands (1).CommandType = adCmdText
      sql="select empid,empname from" & param1 & " where Bookno=" & param2
      (if param2 is integer)
      sql="select empid,empname from" & param1 & " where Bookno='" & param2 & "'"
      (if param2 is string)
      Dtenv1.Commands (1).Execute
      Dtenv1.Recordse ts(1).Open
      If Dtenv1.rsComman d1.RecordCount >= 1 Then
      datreport1.prin treport
      end if

      The above code will surel work
      bye

      Comment

      • bigmoe00100
        New Member
        • Sep 2007
        • 2

        #4
        add data environment and then you can do a command or an sql statement;
        lets say the data environment is DE and has some various connections in it and each data report lets say DR (here you have to put in the properties of the data report which DE it will take from) will take some or all information from the sql query from connection one lets say select * from cust where id = ?
        in code put
        DE.connection1. open
        call DE.DR(id)
        DR.show

        note code in VB
        regards,
        moe

        Comment

        Working...