unit uTiendaWebUtils;

interface

function HayConexionConTienda(const AODBCName : String; var AErrorMsg: String): Boolean;

implementation

uses
  SysUtils, SqlExpr, Dialogs, ADODB;

function HayConexionConTienda(const AODBCName : String; var AErrorMsg: String): Boolean;
var
  ADOConnection1: TADOConnection;
begin
  AErrorMsg := '';
  ADOConnection1 := TADOConnection.Create(nil);
  try
    with ADOConnection1 do
    begin
      Name := 'ADOConnection1';
      Provider := 'MSDASQL.1';
      LoginPrompt := False;
      ConnectionString := 'Provider=MSDASQL.1;Persist Security Info=False;' +
        'Data Source=' + AODBCName;

      try
        Connected := True;
        Result := True;
        Connected := False;
      except
        on E : Exception do
        begin
          Result := False;
          AErrorMsg := e.Message;
        end;
      end;
    end;
  finally
    FreeAndNIL(ADOConnection1);
  end;
end;



end.
