I have two questions for you ADO programmers who are using Delphi with ADO.

1) I have created a recordset, but how do I open it.

var
  RecordSet         : Recordset;
  Source            : OLEVariant;
  Connection        : OLEVariant;
begin
  RecordSet := CoRecordset.Create;
  RecordSet.CursorLocation := adUseClient;
  RecordSet.CursorType     := adOpenStatic;
  RecordSet.LockType       := adLockOptimistic;

  RecordSet.Fields.Append('Sender', adBSTR, 100, adFldMayBeNull);
  RecordSet.Fields.Append('Subject', adBSTR, 100, adFldMayBeNull);
  RecordSet.Fields.Append('Received', adBSTR, 100, adFldMayBeNull);

  RecordSet.Open(Source, Connection, adOpenForwardOnly, adLockUnspecified,
0);


What are the parameters for the Source, and Connection?, in this case I do
not want a connection object associated with the record set. How about the
source paramter?

What values am I suppose to use for those properties?

and next I have some code written in VB that will add a record to an ADO
Record set.

The code goes like this, where rs is an ADODB.RecordSet object;

        rs.AddNew
        rs.Fields("Sender") = msg.SenderName
        rs.Fields("Subject") = msg.Subject
        rs.Fields("Received") = msg.ReceivedTime

In Delphi the type-library uses a method called

    procedure AddNew(FieldList: OleVariant; Values: OleVariant); dispid
1012;

Has anyone used this?, and if so how do I declare and use the fieldlist, and
the value list it wants.

This is the code, but I have no idea what to do for the FieldList, and
Values list. Can they be nil, or un defined or something like that?

      RecordSet.AddNew(?????, ?????);
      RecordSet.Fields['Sender'].Value := 'Chris Crowe';
      RecordSet.Fields['Subject'].Value := 'ADO Stuff';
      RecordSet.Fields['Received'].Value := FormatDateTime('DD/MM/YYYY
HH:MM:SS', Now);

Please help me

Chris

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to