Source Code



Source Code - PQM - Pingi Query Manager

  • anonymous
  • Feb 07' 14
  • Delphi
  • 248
  • 107
  • United States

This is source code for PQM  (Pingi Query Manager), you can try this program by downloading first here

pic

pqm

 

this program use a UDL file to configuring database connection, creat one ang give name 'koneksi.udl'

source udl file

[oledb]
; Everything after this line is an OLE DB initstring
Provider=SQLOLEDB.1;Password=123;Persist Security Info=True;User ID=sa;Initial Catalog=CoporateBMP;Data Source=.

 

 

 


 

unit uFSQL;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, HTTPApp, HTTPProd, CompProd, PagItems, MidProd, DB, DBTables,
  StdCtrls, Grids, DBGrids, ADODB, ExtCtrls, Buttons,ShellApi, SXPNGUtils;

type
  Tfsql = class(TForm)
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    MemoSQL: TMemo;
    TBukaSQL: TButton;
    TEksekusiSQL: TButton;
    server: TADOConnection;
    ADOQuery1: TADOQuery;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    teks: TStaticText;
    teks2: TStaticText;
    Timer1: TTimer;
    Image1: TImage;
    Label89: TLabel;
    Image2: TImage;
    procedure TBukaSQLClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure TEksekusiSQLClick(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure FormResize(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Label4Click(Sender: TObject);
    procedure Label89Click(Sender: TObject);
    procedure Label5Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure Image2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fsql: Tfsql;

implementation

uses Unit1;

{$R *.dfm}

procedure Tfsql.TBukaSQLClick(Sender: TObject);
begin
  if MemoSQL.Text='' then  else
  if ADOquery1.Active then
     ADOquery1.Close;
     ADOQuery1.SQL:=MemoSQL.Lines;
  try
     Adoquery1.Open;
    //Showmessage('Ditemukan '+IntToStr(ADOQuery1.RecordCount)+' Data');

     teks.Caption:=IntToStr(ADOQuery1.RecordCount)+' Data ';
  except
     on E: Exception do
     MessageDlg('Query harus di tulis dahulu'+#13+'atau SQL salah, dengan pesan '+#13+E.Message+#13+'atau periksa file koneksi.udl anda',mtError,[mbOK],0);
     end;
end;

procedure Tfsql.FormShow(Sender: TObject);
begin
     MemoSQL.Text:='';
     teks2.Caption:='FILE NAME='+getcurrentdir()+'\koneksi.udl';
     server.ConnectionString:='FILE NAME='+getcurrentdir()+'\koneksi.udl';
     
end;

procedure Tfsql.TEksekusiSQLClick(Sender: TObject);
begin
  if ADOquery1.Active then
     ADOQUERY1.Close;
     ADOQuery1.SQL:=MemoSQL.Lines;
     try
     ADOQuery1.ExecSQL;
     if adoquery1.RowsAffected>0 then
     teks.caption:=IntToStr(ADOQuery1.RowsAffected)+' Data berhasil di eksekusi'
     else
    teks.Caption:='Tidak ada data yang di eksekusi';
     except
     on E: Exception do
     Messagedlg('SQL Salah cuy:'+#13+E.Message,mtError,[mbOK],0);
     end;
end;

procedure Tfsql.BitBtn1Click(Sender: TObject);
begin
if MemoSQL.Text='' then   else
  if ADOquery1.Active then
     ADOquery1.Close;
     ADOQuery1.SQL:=MemoSQL.Lines;
  try
     Adoquery1.Open;
    // Showmessage('Ditemukan '+IntToStr(ADOQuery1.RecordCount)+' Data');
   teks.caption:=IntToStr(ADOQuery1.RecordCount)+' Data';
  except
     on E: Exception do
     MessageDlg('SQL salah, dengan pesan '+#13+E.Message,mtError,[mbOK],0);
     end;
end;

procedure Tfsql.FormResize(Sender: TObject);
begin
memosql.Width:=fsql.Width-40;
dbgrid1.Width:= fsql.Width-40;
dbgrid1.Height:=fsql.Height-350;
image2.Left:= fsql.Width-270;

end;

procedure Tfsql.Button1Click(Sender: TObject);
begin
form1.show;
end;

procedure Tfsql.Label4Click(Sender: TObject);
begin
shellexecute(0,'open','http://www.penguintechno.com','','',SW_SHOWNORMAL);
end;

procedure Tfsql.Label89Click(Sender: TObject);
begin
shellexecute(0,'open','http://pasarkode.com','','',SW_SHOWNORMAL);
end;

procedure Tfsql.Label5Click(Sender: TObject);
begin
shellexecute(0,'open','http://pasarkode.com','','',SW_SHOWNORMAL);
end;

procedure Tfsql.Timer1Timer(Sender: TObject);
begin
shellexecute(0,'open','http://pasarkode.com','','',SW_SHOWNORMAL);
timer1.Enabled:=false;
end;

procedure Tfsql.Image2Click(Sender: TObject);
begin
shellexecute(0,'open','http://pasarkode.com','','',SW_SHOWNORMAL);
end;

end.
  • Tags : delphi, sql, manager, database
comments powered by Disqus

Related Code

Video Demo of Google Map Api with Delphi 7

Send an e-mail through Outlook

FTP Using Delphi

Load bitmap from resource DLL

Create DB file at runtime

convert minutes in a days / hours / minutes format

How to convert Short to Long filenames

Get Database Path With Alias

SQL data to Excel

Execute a JavaScript Code on a TWebBrowser Document



Category