public oRS as ADODB.RecordSet, oCommand as ADODB.command #DEFINE ADINTEGER 3 #DEFINE ADCHAR 129 oRS = CreateObject( "ADODB.RecordSet" ) oRS.CursorLocation = 3 ors.LockType = 3 oRS.Fields.Append( "c1", ADCHAR, 100 ) oRS.Fields.Append( "i1", ADINTEGER, 4 ) oRS.Open() oRS.AddNew() oRS.Fields("c1").Value = "test1" oRS.Fields("i1").Value = 1 oRS.AddNew() oRS.Fields("c1").Value = "test2" oRS.Fields("i1").Value = 2 oRS.MoveFirst() do while ! oRS.EOF() ? alltrim( oRS.Fields("c1").Value ), oRS.Fields("i1").Value oRS.MoveNext() enddo public oCursorAdapter as CursorAdapter if ( used( "testthis" ) ) use in testthis endif oCursorAdapter = createobject( "cursoradapter" ) oCursorAdapter.DataSourceType ="ADO" oCursorAdapter.Alias = "testthis" oCursorAdapter.DataSource = oRS ? oCursorAdapter.CursorFill( .f., .f., 0, oRS ) select testthis scan ? alltrim( c1 ), i1 endscanthis doesn't generate a RS:
create cursor testthis ( i1 i, c1 c(10), t1 t, m1 m ) insert into testthis values ( 1, "test 1", datetime(), "this is my pretty memo" ) insert into testthis values ( 2, "test 2", datetime(), "this is my prettier memo" ) oRS = CreateObject( "ADODB.RecordSet" ) oRS.CursorLocation = 3 oRS.LockType = 3 oCursorAdapter = createobject( "cursoradapter" ) oCursorAdapter.DataSourceType ="ADO" oCursorAdapter.DataSource = oRS ? oCursorAdapter.CursorAttach( "testthis", .t. ) oRS.MoveFirst() do while ! oRS.EOF() ? alltrim( oRS.Fields("c1").Value ), oRS.Fields("i1").Value oRS.MoveNext() enddoIdeally I need the RS to construct its field collection structure directly from the cursor structure and then push the data into the RS. The CursorAttach() method returns .t. but oRS is pretty much an empty shell. What am I doing wrong/missing? I don't really want the run a select, it doesn't have to be updateable, it's just a RS that we are passing from a VFP COM object over to an ASP page.