Solved

DbiWriteBlock example

Posted on 1998-02-02
5
250 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
proper way to parse text with delphi 7 99
FMX enumerated colours 2 84
How to open a new windows chrome resized and disabled the toolbar? 3 77
Delphi inherited method 6 61
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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

932 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

13 Experts available now in Live!

Get 1:1 Help Now