Posts

Showing posts from August, 2017

ORA-01745: invalid host/bind variable name ERROR in Delphi when we use Oracle DB

I received the above error message when TADOQuery.Open method is called. I checked the SQL of TAdoquery component which looked fine to me but was still getting errors. SQL was as follow AdoQuery1.Sql.text := 'SELECT * FROM EMPLOYEE E WHERE E.JOINDATE < :DATE'; AdoQuery.Open; //---ABOVE ERROR RAISED----// After researching the issue, I found that the  issue is with :DATE parameter that I have used in SQL. A pparently the word "DATE" is a reserved word in Oracle, and therefore cannot be used as a SQL parameter or bind variable name.  You can not use a key word as parameter name.  So I replaced the :DATE parameter with :JDATE in SQL as follow and it worked fine without any error. AdoQuery1.Sql.text := 'SELECT * FROM EMPLOYEE E WHERE E.JOINDATE < :JDATE'; AdoQuery.Open;   // ---ERROR RESOLVED----// So please note* that you should not use any reserve keywords as  parameter while writing SQL in Delphi side. Some of the common Ora...

How to get WINDOWS special directories path in Delphi?

Sometime we need some special directories path from Microsoft Windows system to store User data or to copy some files etc.  So we can get those folder paths in Delphi in several ways. In this blog I have tried to cover all the ways.  If I have left something please feel free to add comments. By using Windows API function SHGetFolderPath  Delphi provides SHGetFolderPath API function which helps us to get windows system folder paths. We need to use  ShlObj unit in uses clause. For more details about SHGetFolderPath please visit following link SHGetFolderPatch Here at following I have created a string function  GetSpecialFolderPath  using SHGetFOlderPath API function which will return all special Windows folder path as per  CSIDLFolder value. function GetSpecialFolderPath(CSIDLFolder: Integer): string; var    FilePath: array [0..MAX_PATH] of char; begin   SHGetFolderPath(0, CSIDLFolder, 0, 0, FilePath);   R...