Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2004
    Posts
    13

    Exclamation Unanswered: data report sql help

    Hi, i am trying to set a sql command in the data environment that need 2 parameters to generate the report. I want to display the report from agent name that start from the first parameter until the second parameter. If i set the sql command like this : SELECT * FROM tblAgent WHERE tblAgent.agentName LIKE "[A-C]%", the report show the records i want, but when i change the sql command to this : SELECT * FROM tblAgent WHERE tblAgent.agentName LIKE "[?-?]%", it show that "Invalid parameter". Anyone can help me ? And one more question, is the .tmp file save to delete ?

  2. #2
    Join Date
    Jun 2004
    Posts
    13
    I found the solution.

    LIKE '[' + ? + ? ']' + '%'

  3. #3
    Join Date
    Nov 2004
    Posts
    108
    are you using a shape command??

    If this is the case there is not much where I can help you since I really do not use the shape command the only thing I can tell you is that I have only seen parameters when using hierarchical recordsets and the PARAMETER keyword is specified within the command.

    and leaving the command as [?-?] leaves SQL clueless of what you are requesting if VB is not replacing the ? with valid parameters
    to err is human ; to really mess things up requires a computer

  4. #4
    Join Date
    Jun 2004
    Posts
    13
    What is shape command ?

    I created a DECommand and just set the sql statement in it. The i set the name of the two parameters. The data report display the correct record that i want now.

    By the way, do you know how to bound images in the data report ? Just like bounding the RptText.

  5. #5
    Join Date
    Nov 2004
    Posts
    108
    a shape command is a command used by ADO to create an ADO hierarchical Recordset.

    From MSDN
    Shape commands may be parameterized. For example, you can specify the following:

    "SHAPE {SELECT * FROM customer}
    APPEND {SELECT * FROM orders WHERE cust_id = ?}
    RELATE (cust_id TO PARAMETER 0)"

    In this case, parent and child tables happen to have a column name in common, cust_id. The child-command has a placeholder (that is, "?"), to which the RELATE clause refers (that is, "...PARAMETER 0". In effect, the relation is between the explicitly identified parent-column, and the child-column implicitly identified by the placeholder).
    Sorry I never use bound controls so I can't help you there
    to err is human ; to really mess things up requires a computer

  6. #6
    Join Date
    Jun 2004
    Posts
    13
    Do you mean create a DECommand2 in a DECommand1 and set it related to the DECommand1 ?

  7. #7
    Join Date
    Nov 2004
    Posts
    108
    I'm really not suggesting anything since I have no expertice on that I'm just explaning how the Shape works but if what you say works then it should have the same effect
    to err is human ; to really mess things up requires a computer

Posting Permissions

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