Results 1 to 2 of 2

Thread: How to pass value to SQL Query in Data Environment's Command Object at run-time?

  1. #1

    Thread Starter
    Addicted Member rpk_20061975's Avatar
    Join Date
    Jun 2001
    Location
    India
    Posts
    234

    How to pass value to SQL Query in Data Environment's Command Object at run-time?

    In DataEnvironment I have a Command Object in which I have
    given following SQL Query:

    -------------------------
    SELECT * FROM customer WHERE billno = billnumber
    -------------------------

    Here billnumber is a public variable in Module.
    This variable accepts value at run-time.

    How to call variable in DataEnvironment's SQL Query?

  2. #2
    Registered User
    Join Date
    May 2013
    Posts
    1

    Thumbs up Re: How to pass value to SQL Query in Data Environment's Command Object at run-time?

    Quote Originally Posted by rpk_20061975 View Post
    In DataEnvironment I have a Command Object in which I have
    given following SQL Query:

    -------------------------
    SELECT * FROM customer WHERE billno = billnumber
    -------------------------

    Here billnumber is a public variable in Module.
    This variable accepts value at run-time.

    How to call variable in DataEnvironment's SQL Query?


    Hi,

    You can follow the below commands for (VB 6): Just try calling the below function by placing under a command button in any of the form from where you want to call the datareport.

    Note:
    Also goto DataEnvironment1 -> Connection1 -> ADD a Command1 and rename the Command1 as customer. Now goto customer properties -> In General tab select SQL Statement and type in...... SELECT * FROM Customer WHERE billno=?

    Private sub Comman1_Click()

    Load DataEnvironment1
    With DataEnvironment1

    If .rscustomer.State <> 0 Then .rscustomer.Close

    .customer (billnumber)

    End With
    Datareport1.Refresh
    If Datareport1.Visible = False Then Datareport1.Show

    End Sub


    Enjoy!

    Buzz me if it works !!!

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