Subject Re: [IBO] using IB_Connection etc. in DLL
Author John vd Waeter
d_dude_2003 wrote:

Hi d_dude,

Shouldn't you be using an IB_DSQL to do this?
AFAIK a IB_Cursor can only produce a readonly, unidirectional resultset
from a SELECT statement.

John


> 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.
>
>
>
>
>
> ___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or InterBase
> without the need for BDE, ODBC or any other layer.
> ___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info papers,
> keyword-searchable FAQ, community code contributions and more !
> Yahoo! Groups Links
>
>
>
>
>


--
John vd Waeter
mailto:john@...
http://www.jvdw.nl
http://www.shotinthedark.nl