Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create Cursor for ADO
Message
From
08/12/2006 06:18:02
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
07/12/2006 16:51:27
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01175883
Message ID:
01176003
Views:
8
This message has been marked as the solution to the initial question of the thread.
>Simple question for ADO. What kind of commands do I use to create a temporary table with ADO, the way FoxPro uses the create cursor command.
>Thanks,
>Daniel
#include adoconstants.h
LOCAL oRS as ADODB.Recordset
oRS = CREATEOBJECT("ADODB.Recordset")

WITH oRS.Fields
  .Append("CustomerID", adInteger,, adFldUpdatable)
  .Append("Company", adVarChar, 50, adFldUpdatable)
  .Append("Contact", adVarChar, 20, adFldUpdatable)
  .Append("MyDateTime", adDate,, adFldUpdatable)
  .Append("MyDate", adDBDate,, adFldUpdatable)
  .Append("MyTime", adDBTime,, adFldUpdatable)
EndWith

With oRs
  .Open()
  FOR ix = 1 TO 10
    .AddNew
    .Fields(0) = m.ix
    .Fields(1) = "Company " + TRANSFORM(m.ix)
    .Fields(2) = "Contact " + TRANSFORM(m.ix)
    .Fields(3) = DATETIME() + m.ix*1000
    .Fields(4) = DATE()+m.ix
    .Fields(5) = DATETIME() + m.ix*1000
  ENDFOR
  .AddNew && defaults
  .UpdateBatch
ENDWITH
ShowMe(oRS)

Function ShowMe
  Lparameters toRecordset
  PUBLIC oForm
  oForm = Createobject('myForm', toRecordset)
  oForm.Show
Endfunc

Define Class myform As Form
  Height = 450
  Width = 750
  Add Object hflex As OleControl With ;
    Top = 10, Left = 10, Height = 430, Width = 730, Name = "Hflex", ;
    OleClass = 'MSHierarchicalFlexGridLib.MSHFlexGrid'

  Procedure Init
    Lparameters toRecordset
    With This.hflex
      .FixedCols = 0
      .Datasource = toRecordset
      .AllowUSerResizing = 3
      .CollapseAll
    Endwith
  Endproc
Enddefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform