#Define OLEDBCONNECTSTRING 'Provider=SQLOLEDB.1;'+; 'Integrated Security=SSPI;'+; 'Initial Catalog=Northwind; Data Source=servername' oForm = Createobject('frmSample') oForm.Show Read Events Define Class frmSample As Form Top = 0 Left = 0 Height = 400 Width = 500 DoCreate = .T. Caption = "Form1" Name = "Form1" Add Object myDataGrid As OleControl With ; Top = 10, ; Left = 10, ; Height = 380, ; Width = 480, ; OleClass = 'MSDataGridLib.DataGrid',; Name = "myDataGrid" Procedure Init This.AddProperty('oConn',Createobject('ADODB.Connection')) This.AddProperty('oRS',Createobject('ADODB.RecordSet')) With This.oConn .ConnectionString = OLEDBCONNECTSTRING .Mode = 16 .Open Endwith With This.oRs .ActiveConnection = This.oConn .Source = 'select * from customers' .CursorLocation= 3 && adUseClient .CursorType= 3 && Static .LockType= 4 && adLockBatchOptimistic .Open Endwith Local oRs As ADODB.Recordset With This.myDataGrid .Datasource=This.oRs .Caption = "Customers Table" Endwith Endproc Procedure QueryUnload If Messagebox('Save ?',4+32,'Save changes') = 6 This.oRs.UpdateBatch Endif This.oConn.Close Clear Events Endproc EnddefineCetin