Check Connection ADOConnection with ComObj Unit

Today i will share a tips for delphi programmer for beginner. This time i’d like to share about how to check Connection from ADOConnection is it the server establish or not.

First you have to use ComObj Unit, because we need EOleException Function to check availability server connection. Well here’s an example :

unit Unit1;

interface

uses

ComObj, Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs;

type
TForm1 = class(TForm)

……

After append unit ComObj in uses list, you can use EOleException in your code like this

with ADOConnection1 do
Try
Connected := True;
except
on EOleException do
begin
MessageDlg(‘Connection Broken, Please try to connect again !’,MtInformation,[mbOK],0);
end;
end;

I hope this tips can make us getting better to learn Delphi

Bookmark and Share

About Andi Eko

This blog talk about any information about Technology and Business. This is the part of my journey surfing the Jungle of Internet when people got many information from there and I tried to collected it, not all but some of interested articles. Enjoy the show.
This entry was posted in delphi. Bookmark the permalink.

One Response to Check Connection ADOConnection with ComObj Unit

  1. roro says:

    Assalamu’alaykum

    eh Bab, sorry ya…
    apa ga terlalu boring nih tampilannya ?

    Wassalam

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>