Skip to Content
author's profile photo Former Member
Former Member

Problem with RecordSet in Delphi 8

Hello,

I have a problem with RecordSet object.

When I write example code e.g.

var oRS : SAPbobsCOM.Recordset;

count : Integer;

s : String;

begin

oRS := Cmp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);

s := 'select * from OCRD';

oRS.DoQuery(s);

count := oRS.RecordCount;

end;

Variatable count = 0. I don't understend this.

I have correct connect to company Cmp. And I have data in data base.

Please, if your know how resolve this problem - help me!

Regards,

Tomasz

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 13, 2005 at 02:27 PM

    Hi,

    I just suggest to first 'Select count(*) from OCRD', to get the recordcount, and after doquery 'Select * from OCRD'.

    (Do you need all fields of OCRD table? Why don't you just select the necessary fields?)

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Did you tried with Delphi 7?

      I tried and works,

      uses SAPbobsCOM_TLB;

      ...

      var

      oCompany : Company;

      oRS: Recordset;

      begin

      oCompany := CoCompany.Create;

      oCompany.Server := ....

      ....

      oRS := oCompany.GetBusinessObject(BoRecordset) as IRecordset;

      oRS.DoQuery('Select * from OCRD');

      ShowMessage(IntToStr(oRS.RecordCount))

      end;

  • author's profile photo Former Member
    Former Member
    Posted on Jan 13, 2005 at 07:56 PM

    hello

    I'm Using Delphi 2005

    code example

    FoRecSet.DoQuery('select max(field) as cod from table')

    if FoRecSet.RecordCount > 0 then begin

    ....

    ....

    end;

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.