CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: DataReport

  1. #1
    Join Date
    Dec 2001
    Location
    NJ
    Posts
    17

    DataReport

    I have a form (F) with text box T. Also Created 1 DataEnvironment and DataReport. (connection with DB is tested OK)
    DataEnvironment is created using Query statement.
    When new command is created using SQL statement we can not add parameters.
    Question 1: How to Dyanamically change the condition (commandText) ?
    2: How to Pass values from Form to Report. (parameters)

    Please advice

    Thanks


  2. #2
    Join Date
    Dec 2001
    Location
    Salamanca, Guanajuato, Mexico
    Posts
    3

    Re: DataReport

    In the dataenviorment you need to make a SQL statement, and the parameters that you need to change put in '?', for example i need the records between 2 dates, in the dataenviorment in the SQL statement I write the follow "SELECT fecha, litrosreacom, precio, importereapag FROM SarabiaAsf WHERE litrosreacom <> 0 and fecha BETWEEN ? and ?" and in the form the next code

    If DataEnvironment1.rsCommand1.State = adStateOpen Then
    DataEnvironment1.rsCommand1.Close
    End If
    DataEnvironment1.Command1 Format(CDate(DTPicker1.Value), "dd/MM/yyyy"), Format(CDate(DTPicker2.Value), "dd/MM/yyyy")
    DataReport1.Show

    i hope that this would be helpful


  3. #3
    Join Date
    Dec 2001
    Location
    NJ
    Posts
    17

    Re: DataReport

    Thank You, Great Help !!!
    It did Work, Now I have another small Question
    How to pass Values to DataReport.
    I have a form with UserName and Today(Date) as text box. 1 push button. on click event I am calling DataReport. On DataReport I have 1 text box rUserName. How to assign Form.Username.text to rUserName ?

    Please Advice

    Thanks



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured