Results 1 to 6 of 6

Thread: Query on ADO Recordset

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Posts
    10

    Post

    Hi,

    I have a ADO recordset object which retreive data from database. now I want to run queries on that recordset. Is it possible to do this? if Yes, send me details. or any other alternative if anybody know (Momory Tables etc.)

    Thanks.

  2. #2

    Post

    Put a DataGrid on the form and connect it to the ADO control.

    Make a button.

    In the click event, simply type

    Command1_Click()

    Dim SomeVariable as String
    SomeVariable = "Patrick"

    Adodc1.DataSource="Select * FROM YourTable WHERE FirstName = '" & SomeVariable & "'"

    Adodc1.Refresh

    End Sub

    Your DataGrid (eg. MSHFlex) should dynamically change and return all 'Patricks' in your 'FirstName' column

    This works pretty consistently with adClient cursors, but with adServer cursors this may cause premature baldness.


  3. #3
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    No, no built-in function in an ADO RS... you'll need to requery the DB for the SUM (the best & fastest way) or do it manually on the client

  4. #4
    Hyperactive Member
    Join Date
    May 1999
    Location
    Reynosa, Mexico
    Posts
    274

    Post

    I'm using an ODBC DSN to connect to the database. Is there any way to connect a DataGrid or a FlexiGrid to a recordset without any datacontrol?

    Thanks!

  5. #5
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    I believe you can set the FlexGrid.Recordsource to a recordset object at runtime.....

  6. #6

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Posts
    10

    Post

    Thanks for reply.
    Actually, The query which your are sayinhg will again goto Database to retrieve data. Let me explain problem again.

    Suppose, I have a recordset(Unbound mode : NOT bound to any database) which is filled with EmpNo, DeptNo, Salary by (Select * From EMP) query. Now I want to make summation of Salary.
    I don't want to Parse each and every record to get the Sum(Salary).
    ( Result simmilar to query
    Select SUM(Salary) from Emp )

    One way is I will declare a variable, use MoveNext method till EOF and add salary in variables . But this will be take more time records in thousands. Now is there any in build function of ADO which will directly give me Summation of fields.



    [This message has been edited by hi_vijay (edited 02-17-2000).]

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