Click to See Complete Forum and Search --> : recordset.open <filename> problem


almike
February 10th, 2000, 04:48 PM
I have an ADODB.recordset that I am generating programitically... it is not connected to a database table, file, or SQL command. I tried to do a recordset.sort on it and that caused an error.

Is the sort method supported for a recordset that is not pointing to a table, file or SQL command?

Also, while trying to do a work-around, I did a recordset.save to a file and then re-opened it. The recordset data looks great prior to saving the file, but once I re-open the rccordset from the file, some of the data is corrupted - specifically, the first character in some of the strings. Anybody have any ideas why this data was corrupted. I saved it in the ADTG format.

Thanks.


PSH

Lothar Haensler
February 11th, 2000, 01:23 AM
here is a sample for sorting a recordset:

Dim r as new ADODB.Recordset
r.Fields.Append "test", adChar, 10
r.Fields.Append "test2", adChar, 10
r.CursorLocation = adUseClient
r.Open
r.Sort = "test"
r.AddNew
r.Fields(0) = "test"
r.Fields(1) = "test2"
r.Update
r.AddNew
r.Fields(0) = "atest"
r.Fields(1) = "atest2"
r.Update
' assign it to a data grid
set g.DataSource = r




This didn't work, when the data type for the fields was adBSTR, only with adCHAR.
Also, you need to use Cursorlocation = adUseClient.