>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 >endscan >>
>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() >enddo >>