Subject | using IB_Connection etc. in DLL |
---|---|
Author | d_dude_2003 |
Post date | 2007-04-13T16:36:12Z |
Hi,
I am trying to write a simple DLL routine to insert a row in db
table.
Here is the code:
vConnection := TIB_Connection.Create(nil);
vTransaction := TIB_Transaction.Create(nil);
vCursor := TIB_Cursor.Create(nil);
try
vConnection.DefaultTransaction := vTransaction;
vTransaction.IB_Connection := vConnection;
vConnection.Protocol := cpTCP_IP;
vConnection.Username := 'SYSDBA';
vConnection.Password := 'masterkey';
vConnection.DatabaseName := 'MyAlias';
vConnection.Server := '127.0.0.1';
vConnection.Path := 'MyAlias';
vConnection.Connect;
vCursor := TIB_Cursor.Create(nil);
vCursor.IB_Connection := vConnection;
vCursor.SQL.Add('INSERT INTO VISITOR(NAME_FIRST, NAME_LAST)
VALUES (:NAME_FIRST, :NAME_LAST)');
vCursor.ParamByName('NAME_FIRST').AsString := FirstName;
vCursor.ParamByName('NAME_LAST').AsString := LastName;
vTransaction.StartTransaction;
try
vCursor.Execute;
vTransaction.Commit
except
vTransaction.Rollback
end
finally
vCursor.Free;
vTransaction.Free;
vConnection.Free
end
When i am calling this routine, it raise EIB_ConnectoinError
exception. Whats wrong?
Thanks.
I am trying to write a simple DLL routine to insert a row in db
table.
Here is the code:
vConnection := TIB_Connection.Create(nil);
vTransaction := TIB_Transaction.Create(nil);
vCursor := TIB_Cursor.Create(nil);
try
vConnection.DefaultTransaction := vTransaction;
vTransaction.IB_Connection := vConnection;
vConnection.Protocol := cpTCP_IP;
vConnection.Username := 'SYSDBA';
vConnection.Password := 'masterkey';
vConnection.DatabaseName := 'MyAlias';
vConnection.Server := '127.0.0.1';
vConnection.Path := 'MyAlias';
vConnection.Connect;
vCursor := TIB_Cursor.Create(nil);
vCursor.IB_Connection := vConnection;
vCursor.SQL.Add('INSERT INTO VISITOR(NAME_FIRST, NAME_LAST)
VALUES (:NAME_FIRST, :NAME_LAST)');
vCursor.ParamByName('NAME_FIRST').AsString := FirstName;
vCursor.ParamByName('NAME_LAST').AsString := LastName;
vTransaction.StartTransaction;
try
vCursor.Execute;
vTransaction.Commit
except
vTransaction.Rollback
end
finally
vCursor.Free;
vTransaction.Free;
vConnection.Free
end
When i am calling this routine, it raise EIB_ConnectoinError
exception. Whats wrong?
Thanks.