Solved

DbiWriteBlock example

Posted on 1998-02-02
5
249 Views
Last Modified: 2010-04-04
Does any one have an example using the DbiWriteBlock?
0
Comment
Question by:ronit051397
  • 3
  • 2
5 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 50 total points
ID: 1358114
The one from the DBE help file? :

Add multiple records to a table

This example assumes that the Customer TTable object is the Customer.DB table. It uses the following input:      fDbiWriteBlock(Table1; NumRecs);

procedure fDbiWriteBlock(Customer: TTable; var RecordsToInsert: Longint);
var
  pRecordsBuf, pTmpBuf: pBYTE;
  Rec: longint;
  CustNo: double;

begin
  Randomize;
  GetMem(pRecordsBuf, Customer.RecordSize * RecordsToInsert);
  pTmpBuf := pRecordsBuf;
  try
    for Rec := 1 to RecordsToInsert do
    begin
      CustNo := Random(1000000);
      // Iterate through the entire record buffer filling each individual record with information
      with Customer do
      begin

        Check(DbiInitRecord(Handle, pTmpBuf));
        Check(DbiPutField(Handle, FieldByName('CustNo').Index + 1, pTmpBuf,
                pBYTE(@CustNo)));
        Check(DbiPutField(Handle, FieldByName('Company').Index + 1, pTmpBuf,
                PChar('Borland International')));
        Inc(pTmpBuf, RecordSize);
      end;
    end;
    Check(DbiWriteBLock(Customer.Handle, RecordsToInsert, pRecordsBuf));
  finally
    FreeMem(pRecordsBuf, Customer.RecordSize * RecordsToInsert);

  end;
end;
0
 
LVL 5

Author Comment

by:ronit051397
ID: 1358115
How do I use DbiAppendRecord instead of DbiPutField?

0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1358116
?
DBiWriteBlock writes several records to a table.
DbiAppendRecord writes one reocrd to a table.

Both have to be filled with DbiPutField. (See also BDE help)


0
 
LVL 5

Author Comment

by:ronit051397
ID: 1358117
Thanks.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1358118
My pleasure. Hope you can go further on.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now