Capturing SQL error codes in Delphi

Anyone know if it is possible to get the SQLERROR or SQLSTATE codes back in
Delphi?



0
Dean
10/26/1999 9:33:40 PM
sybase.sqlanywhere.general 32637 articles. 4 followers. Follow

3 Replies
893 Views

Similar Articles

[PageSpeed] 24

After an error, you can issue the following queries.

select SQLCODE

or

select SQLSTATE

Chris

Dean Wooldridge wrote:

> Anyone know if it is possible to get the SQLERROR or SQLSTATE codes back in
> Delphi?

1
Chris
10/28/1999 8:28:04 PM
>Anyone know if it is possible to get the SQLERROR or SQLSTATE codes back in
>Delphi?


There may be more direct ways, but you could always 

SELECT SQLSTATE INTO  somevariable;

But keep in mind that this must be the first statement following the failure, as each statement
resets the sqlstate.  I don't know your options in delphi, but if it begins by doing a PREPARE on
this statement then you'd lose the sqlstate that you want to get. 


Leo Tohill - Team Sybase
>> Please post in newsgroup, not via email <<
0
leotohill
10/29/1999 4:21:50 AM
On the first look you can't get SQLCode or SQLState back in Delphi via
select. In the moment execution of yours query it's values will be resets.
You can try parse BDE errors stack. Little very simple example:

procedure ShowErrorStack(E: EDBEngineError);
var
  i: Integer;
  err: TDBError;
begin
  for i := 0 to E.ErrorCount - 1 do
  begin
    err := E.Errors[i];
    ShowMessage(Format('StackPosition: %d, Category: %d, ErrorCode: %d,
Message: %s, NativeError: %d, SubCode: %d',
    [i, err.Category, err.ErrorCode, err.Message, err.NativeError,
err.SubCode]));
  end;
end;

procedure GetSomeImportantData;
begin
    try
        qryMyImportantData.Open;
    except
        on E: EDBEngineError do  ShowErrorStack(E);
    end;
end;

NativeError is yours SQLCode. May be it is will be helpful for you.

PS. Sorry for my bad English

Oleg Kovalevsky
------------------------------------------------------------
Oleg Kovalevsky
Moscow, Russia


0
Oleg
10/29/1999 9:18:31 AM
Reply:

Similar Artilces:

Dynamic SQL Error SQL error code = -104 Token unknown in procedure
Hi all, I'm a newbie. I test my procedure in SQL interactive but got error: -------------------------------------------------------- Error at line 1 Dynamic SQL Error SQL error code = -104 Token unknown - line 5, char 3 : SQL - CREATE PROCEDURE CreateNewSystem(NewSystemID VarChar(10), CurrentSelection Int, NewSystemName VarChar(20), CheckChild Boolean) AS DECLARE VARIABLE LeftRightValue INTEGER; begin IF :CheckChild THEN SELECT LeftRightValue = lft FROM "MEP_SYSTEMS" WHERE category_id=:CurrentSelection; ELSE SELECT LeftRightValue = rgt FROM "MEP_...

Dynamic SQL Error SQL error code = -104 Token unknown in procedure #2
Hi all, I'm a newbie. I test my procedure in SQL interactive but got error: -------------------------------------------------------- Error at line 1 Dynamic SQL Error SQL error code = -104 Token unknown - line 5, char 3 : SQL - CREATE PROCEDURE CreateNewSystem(NewSystemID VarChar(10), CurrentSelection Int, NewSystemName VarChar(20), CheckChild Boolean) AS DECLARE VARIABLE LeftRightValue INTEGER; begin IF :CheckChild THEN SELECT LeftRightValue = lft FROM "MEP_SYSTEMS" WHERE category_id=:CurrentSelection; ELSE SELECT LeftRightValue = rgt FROM "MEP_...

[Delphi 2007] Fake code-errors in Code-Editor
Hi, I'm facing following problem: sometimes (w/o visible reason) IDE marks portions of my unit's code as erroneous (mostly "undeclared identifier" in "structure" window) despite code is OK. It's enough to delete one empty line from the code and everything backs to normal. Of course despite of error messages code compiles sucessfully. Anyone faced such behaviour ? My version is 11.0.2902.10471 wirh dec 2007 update installed ,OS is XP SP3 Thanks in advance Mati. Mateusz Kaleta wrote : > I'm facing following problem: sometimes (w/o visi...

SQL statement failed: (-305) I/O error Fatal error: A disk read from file "SomeDatabase.db" failed with error code: (38)
SQL Anywhere 10.0.1.3831 E. 2009-09-11 21:55:41. SQL statement failed: (-305) I/O error Fatal error: A disk read from file "D:\FHMSL\iFHMS\Data\Feedlot111.db" failed with error code: (38) -- transaction rolled back E. 2009-09-11 21:55:41. Error while executing hook procedure sp_hook_dbmlsync_end. Received this error while running a proc during sync. Tried to validate the db in Sybase Central resulting in the same error. I saw the post at http://groups.google.com/group/sybase.public.sqlanywhere.general/browse_thread/thread/b5d958904160e576?fwc=1 and am wondering if th...

SQL code error
Hello, I cannot get this sql query to run:    Insert Into ProcessQueue (queued_url, que_user, dqueued, quepriority, status) Values ('domain.com', '1000', GetDate(), '5', IF (Select Count(*) From ProcessQueue Where Status = '1') > 3 Then '0' Else '1') Im getting: Incorrect syntax near the keyword 'IF'.Incorrect syntax near the keyword 'Then'.Also, Is there anyway to return the value which was placed into the status column to my app for processing or do I have to open a data reader and...

General SQL Error
When I am running the project in Delphi XE (which has been coded in Delphi 2006), its throwing the error. The error reads as below: Project DATATOOL.exe raised exception class EDBEngineError with message 'General SQL Error. Specified driver could not loaded due to System Error 14003 (iSeries Access ODBC Driver). Alias: passdb'. and when I click on break it goes to the below line: PSLoginDataMod := TPassdata.Create(nil); and Create procedure is as below: procedure TPassdata.PassdataCreate(Sender: TObject); begin try Session1.Open; db.Connected := true; except MessageDlg(...

General SQL Error
Hi Sybase Veterans, I have a encountered the following error message : - General SQL error ct_cmd_alloc():user api layer: external error: The connection has been marked dead. I have no idea what could cause such an error but I encounter this problem for some sql select statements. Could any of the veteran sybase user advise on what kind of error this is? Thanks in advance, Candra I have gotten this error, we managed to track this down to a physical networking problem. (A WAN connection was switching states and causing the disconnect). This error will occur when CT l...

SQL error codes
Hi, I am getting sql error 21, which is "Fatal Error 216 occurred at %S_DATE. Please note the error and time, and contact a user with System Administrator (SA) authorization." Can someone please tell if 216 is 'sql error 216' ? Also, I would like to know when sql error 21 is raised. the reference manual doesnt seem very descriptive and I was not able to find the information elsewhere. please help .. thanks in advance mukund mukund wrote... > Hi, > > I am getting sql error 21, which is > > "Fatal Error 216 occurred at %S_DATE....

General SQL Error
Runing this query from a Borland reporting tool: SQL Statement: SELECT T1.code_div_d code_div_d, T1.date_trf date_trf, T1.code_div code_div, T2.cod_prd cod_prd, T2.des_prd des_prd, T3.pren_usr pren_usr, T3.nom_usr nom_usr, T5.des_cons des_cons, T2.chpar2 chpar2, T6.des_ctg des_ctg, (rtrim( T3.nom_usr ) + ', ' + T3.pren_usr) fullname, (T5.des_cons + ' ' + T2.des_prd) make_model FROM transfer T1 , produit T2 , utilisateur T3 , prd_resp T4 , construct T5 , categorie T6 WHERE T1.cod_prd*=T2.cod_prd AND T4.code_usr=T3.code_usr AND T2.co...

iPrint error codes
Can I obtain a list of iPrinter error codes? What does error code 1223 mean? Please help. Thanks. I'll aski. Suzanne Miles Volunteer Sysop, Novell Support Connection http://support.novell.com/forums/ when and where are you getting this error? Suzanne Miles Volunteer Sysop, Novell Support Connection http://support.novell.com/forums/ ...

"SQL Error: Error mapping failed" with Delphi 6 Application and DBExpress
Im using Delphi 6, Firebird 2.x, dbExpress The problem is only with remote database connection and not with local connection. The following connection gives and error Database := MyServer:C:\DEMO.FDB But when locally connected i.e database in the same computer Database := C:\FBdatabases\dbAccounts.FDB Following solution from Firebird forun worked ----------------------------------------- Actually, the issue is inside Borland's DBX driver for InterBase. It's not very much compatible with Firebird. First of all, it uses some internal (metadata) queries in the...

General error in the 'certicom_ssl' network layer...The system specific error code is -6993
Mobilink 8.0.0.2213 ASA 8.0.0.2213 Some of our Mobilink clients were intermittently getting failures which showed at the consolidated as - "General error in the 'certicom_ssl' network layer. The operation would cause blocking. The system specific error code is -6993(...)" - which we were brushing off as 'comms problems', as this was the only advice we could find. Two clients now *persistently* get this error, so it's time to delve. Can anyone shed light? Looking at the debug messages at the consolidated end, it appears as though the upl...

'Too many characters' error in sql string
Hello i constructed the following query in SQL management studio and it runs fine, exactly how i want it to. However when i run it in my code behind i get the error: 'Too many characters in character literal' I desperatly need to use this query exactly how it displays in the mangement tool - why wont it work the same in my code behind? (I am using c# in my code behind and binding the results of the query to a gridview) Regards "SELECT DISTINCT (dbo.AuthorList(publicationID))+ ';' + ISNULL(' Editor: '+Publication.editor, '')+ '' + ISNULL...

General error: Run time SQL error -- Index "sys_attribute_uniqueness" has an inaccurate leaf page count statistics
Hi, We use Asa 8.03.5022 and with a specific database we get the following error : General error: Run time SQL error -- Index "sys_attribute_uniqueness" has an inaccurate leaf page count statistics. If we run a validate everything is oke, but after some "actions" from our program we get the error above. These actions are not much more than openening and closing the database. I tried with a lot of other databases, but I can't reproduce these error with this databases. I have already done a complete rebuild of the specific database, but I get these error again...

Web resources about - Capturing SQL error codes in Delphi - sybase.sqlanywhere.general

Capturing the Friedmans - Wikipedia, the free encyclopedia
Jarecki initially was going to make a film about children's birthday party entertainers in New York, including the popular clown David Friedman. ...

Newscasts on Facebook Are Capturing Attention
With Facebook becoming more and more of a source of news , manager of strategic partnerships for broadcast Beth Loyd examined the newscasts being ...

Capturing Growth: Photo Apps and Open Graph
People upload an average of more than 300 million images to Facebook every day, making photos a core part of the Facebook experience. Developers ...

App Store - Mammoth Web2Pic: Webpage Full Size Capturing
Read reviews, get customer ratings, see screenshots, and learn more about Mammoth Web2Pic: Webpage Full Size Capturing on the App Store. Download ...

Billybee57 (Capturing Light)'s favorite photos and videos - Flickr
Explore Billybee57 (Capturing Light)'s favorites on Flickr. Billybee57 (Capturing Light) has 72 favorites.

Camera Extras for Nokia Lumia More Options for Capturing Great Pictures - YouTube
Camera Extras for Nokia Lumia More Options for Capturing Great Pictures - YouTube

The camera is capturing the modern narrative
When a couple left the theatre two nights ago after seeing the wordless new documentary extravaganza, Samsara, they marvelled at the opening ...

Prize puts focus on capturing the emotion
Sally Pryor looks at how the National Photographic Portrait Prize is shaping Australian photography.

Capturing Kurt Cobain
Melbourne-based Stephen Sweet, who photographed Nirvana for the now defunct British magazine Melody Maker and is presenting a Cobain retrospective ...

A year capturing the trauma and love felt by the families
I started photographing families from migrant communities in western Sydney with Alzheimer's disease because I didn't see a lot of representation ...

Resources last updated: 12/28/2015 6:32:39 AM