Hello,
as PureBasic does not natively support connection to Microsoft SQL Server nor ORACLE database, I use for a SQL Server connection ADOmate.
When I insert a row into a table leaving ID off cause it is an identity field, how can I get the last number generated.
I tried calling ADOmate_DatabaseQuery with "select @@IDENTITY" after inserting data, but got no correct answer (only type mismatch error).
A convert lead to NULL only.
Does someone ran into this problem before?
Thanks in advance,
regards
PB5.31; ADOmate; @@IDENTITY; MS SQL Server;
Re: PB5.31; ADOmate; @@IDENTITY; MS SQL Server;
This is how I did it:
Code: Select all
If ADOmate_DatabaseQuery(MSSQL_Connection, "SELECT @@IDENTITY AS 'ID' From dbo.positions", #adOpenStatic)
sw_positionID.l = ADOmate_GetDatabaseLong(MSSQL_Connection, 0)
EndIf