|
-
Nov 8th, 2000, 09:26 AM
#1
Thread Starter
Member
Hi all,
Ok, so I have ADODC and a DataGrid. The DataGrid displays the query result that I put in.
Now my question is, is it possible do manipulate (sort, etc) what's in the DataGrid without sending more queries into the Database? In other words, is it possible to treat that data inside the DataGrid as disconnected data?
I know it's possible if I use recordsets and such, but can I do it without?
If I HAVE to use recordsets, and my recordset variable is rs, can I just do "DataGrid1.DataSource = rs"? Is this possible?
Thanks a lot!!
-
Nov 9th, 2000, 09:54 AM
#2
Fanatic Member
yes
U get a disconnected a recordset by setting your .ActiveConnection to Nothing once you get your recordset....
The cursor service then alllows you to do anything with your recordset...
make any changes without connecting to the db...
and if you want to update any the db with any of your changes later on...
use .resync
good luck
-
Nov 9th, 2000, 10:09 AM
#3
Thread Starter
Member
One more
Lafor,
Thanks for the reply. Ok one question. What if I want to sort the data in the datagrid?
How do I do that with the cursor service? Because that means I have to Query the disconnected data. Can I do that?
Thanks!!
-
Nov 9th, 2000, 10:13 AM
#4
Fanatic Member
...
The cursor service is just Microsoft's term to allow one
to do all this stuff...
You invoke it when you set your
.cursorlocation to aduseclient
note once u have the disconnected recordset
you can do anything you want
If you want to sort your datagrid
sort the underlying recordset
and reload the data grid with that recordset
and refresh it...
am i making sense?
-
Nov 9th, 2000, 10:24 AM
#5
Thread Starter
Member
Sorry
Lafor,
Yes you are making sense.
But can you show an example of the command to "sort the underlying recordset"?
How exactly do I do it? Do I do a SELECT * FROM Data1.RecordSet ORDER BY ...?
Thanks! Sorry that I have to ask so many questions.
-
Nov 9th, 2000, 10:26 AM
#6
Fanatic Member
...
Read your question again... Was not sure whether you were asking for the following...
... (from the help files)
Specifies one or more field names the Recordset is sorted on, and whether each field is sorted in ascending or descending order.
Settings and Return Values
Sets or returns a String of comma-separated field names to sort on, where each name is a Field in the Recordset, and is optionally followed by a blank and the keyword ASCENDING or DESCENDING, which specifies the field sort order.
Remarks
The data is not physically rearranged, but is simply accessed in the sorted order.
A temporary index will be created for each field specified in the Sort property if the CursorLocation property is set to adUseClient and an index does not already exist.
Setting the Sort property to an empty string will reset the rows to their original order and delete temporary indexes. Existing indexes will not be deleted.
-
Nov 9th, 2000, 10:31 AM
#7
Fanatic Member
okk...
Our msgs crossed...
Ex..
Set cmd.ActiveConnection = conncmd.CommandText = "SELECT * from authors"'
rs.CursorLocation = adUseClient
rs.Open cmd, , adOpenStatic, adLockBatchOptimistic'
---THIS LINE AN INDEX ON LAST NAME (IF U WANT TO SPEED
--SEARCHES (of DISC RECORDSET)
rs!au_lname.Properties("Optimize") = True
rs.Sort = "au_lname"
etc...
If u want to sort by more fields
rs.sort = "au_lname, next field,...etc"
-
Nov 9th, 2000, 10:37 AM
#8
Thread Starter
Member
You da man
Lafor,
That's what I want, that's what I need. Thanks a lot bud!!
I can't believe it took forever for me to figure something simple like this. I have MSDN too, but I couldnt find the thing in there. Thanks a lot again. Have a nice day.
Martin
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|