var
DPB_Buffer:
array [0..255]
of Char;
DPB_Index: Integer;
DBName_Cstr:
array [0..255]
of Char;
begin
{Initialise the buffer index and set the first character
value which is always the parameter buffer version number}
DPB_Index := 0;
DPB_Buffer[DPB_Index] := Char(isc_dpb_version1);
Inc(DPB_Index);
{Set the user name parameter identifier and copy the name
from the user name edit field on the form}
DPB_Buffer[DPB_Index] := Char(isc_dpb_user_name);
Inc(DPB_Index);
DPB_Buffer[DPB_Index] := Char(Length(Edit_Username.Text));
Inc(DPB_Index);
StrPCopy(@DPB_Buffer[DPB_Index], Edit_Username.Text);
Inc(DPB_Index, Length(Edit_Username.Text));
{Set the password parameter identifier and copy the name
from the password edit field on the form}
DPB_Buffer[DPB_Index] := Char(isc_dpb_password);
Inc(DPB_Index);
DPB_Buffer[DPB_Index] := Char(Length(Edit_Password.Text));
Inc(DPB_Index);
StrPCopy(@DPB_Buffer[DPB_Index], Edit_Password.Text);
Inc(DPB_Index, Length(Edit_Password.Text));
{Copy the database name from the edit field on the form to a
C-string style character array}
StrPCopy(DBName_Cstr, Edit_DBName.Text);
{Initialise the database handle to nil - mandatory}
db_handle :=
nil;
{Attach to the database}
isc_attach_database(@Status_Vector, Length(Edit_DBName.Text),
@DBName_Cstr, @db_handle, DPB_Index, DPB_Buffer);
{Check for errors…}