Results 1 to 2 of 2

Thread: CommandText

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Pilipinas
    Posts
    441

    CommandText

    This is my problem:

    Assuming this is my MDB file and their records.
    ==============================================

    Employee
    ============================
    EmployeeNo EmployeeName
    ============================
    HDM23860 Mead Lou
    HDM23861 Gou Li
    ============================

    EmployeeData
    =======================================
    EmployeeNo Date Salary
    =======================================
    HDM23860 10/22/02 250.00
    HDM23861 10/22/02 280.00
    HDM23860 10/23/02 0.00
    HDM23861 10/23/02 200.00
    HDM23860 10/24/02 250.00
    HDM23861 10/24/02 280.00
    HDM23860 10/25/02 250.00
    HDM23861 10/25/02 170.00
    HDM23860 10/26/02 125.00
    HDM23861 10/26/02 280.00
    =======================================

    In VB6, I add DataEnvironment. Using Microsoft Jet 4.0 OLE DB Provider.
    I add a Command1 and the CommandText is "Select * from Employee"
    In Command1, I add a Child Command and the CommandText is "Select * from EmployeeData"

    My question is, Is it possible to display the record in EmployeeData from 10/22/02 to 10/24/02?

    The output I want is something like this:

    HDM23860 Mead Lou
    ==============================================
    HDM23860 10/22/02 250.00
    HDM23860 10/23/02 0.00
    HDM23860 10/24/02 250.00

    HDM23861 Gou Li
    ==============================================
    HDM23861 10/22/02 280.00
    HDM23861 10/23/02 200.00
    HDM23861 10/24/02 280.00


    Marivic reply me like this:

    Add it to your commandtext.

    commandtext="Select * from EmployeeData WHERE Date>10/22/02 AND Date<10/24/02"

    I try the code:

    'This code work
    DataEnvironment1.Commands(1).Commandtext="Select * from Employee"
    DataEnVironment1.rsCommand1.Requery

    'But I encounter an error with this code:
    DataEnvironment1.Commands(2).CommandText="Select * from EmployeeData WHERE Date>10/22/02 AND Date<10/24/02"
    DataEnvironment1.rscommand2.Requery

    What is the best thing to do?

  2. #2
    Junior Member
    Join Date
    Jan 2001
    Location
    Durham, NC
    Posts
    28
    Are you doing this in VB.net or VB6. If it's VB6 you'll probably get more answers in the General VB Questions Forum.

    What error are you getting when you try to use the code that you were given?

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