Showing posts with label Delphi Programing. Show all posts
Showing posts with label Delphi Programing. Show all posts

HOW TO CONNECT MYSQL TO BORLAND DELPHI USING MYODBC

HOW TO CONNECT MYSQL TO BORLAND DELPHI USING MYODBC
  1. Creating MySQL ODBC DataSource
  1. We need to install MyODBC (you can download from www.mysql.com)
  2. install MyODBC or MySQLODBC
  3. Create DSN for accesing trough ODBC, follow the step bellow :
  4. Go To Control Panel>>Administrative Tools>>Data Source (ODBC)
  5. When ODBC Data Source Administrator dialogs showed click Add.. button
  6. Create New Data Source dialog will show, choose MySQL ODBC Driver
  7. Click Finish until MySQL ODBC Driver DSN Configuration dialog showed
  8. Enter Data Source Name as you like
  9. fill all information that needed for connection to be occurred
  10. Click Test Data Source Button to testing the connection to MySQL Server
  11. Connection succeed
  12. MySQL ODBC Data Source created
  1. Connecting Data Source to Delphi using ADOConnection
  1. on your project application pick ADOConnection Component in ADO VCL Tab
  2. Put ADOConnection component into a form
  3. Double Click the ADOConnection on your form until Connection String Dialog Wizard appeared
  4. Choose Use Connection String and then click Build Button
  5. when Data link properties dialog box appeared on the provider tab choose Microsoft OLEDB Provider for ODBC Drivers
  6. Click Next Button
  7. On the Connection Tab, fill all the field
  8. Choose Use Data source name and fill thecombobox with MySQL ODBC Data source that we have been created before in DSN
  9. fill information for username, password, and fill the database that you want access in Combobox Enter initial catalog to use
  10. Test the connection with clicking the Test Connection Button
  11. Connection Succed
Download PDF File
Download AVI File

Access INI File using Delphi


Access INI File using Delphi

For read and write the INI File from Delphi, you can used special class which provided by Delphi, that is TIniFile.
Step for using the TIniFiles :
1. On Uses section declare the IniFiles.
2. On Var Section declare variable which type is TIniFiles
3. Make the object TiniFiles type with Create(FileName:string) methode. FileName Parameter declare the name of file which will open. For the default the directory pointed to \Windows directory. If you work in the different directory used the absolute path.
4. Do INI File operations like write and read value.
5. Destroy TIniFiles Object with Free Methode
For Excample Code you can see at bellow :
Uses
IniFiles;
Implementation
Procedure Tfor1.Formcreate(Sender: Tobject);
Begin
Label1.Caption := ‘Tekan tombol berikut dan pada direktori’ + #13 + ‘”’ + GetcurrentDir + ‘”’ + #13 + ‘buka file “Seting.ini” yang terbentuk.’;
End;
Procedure Tform1.Button1Click(sender: TObject);
Var
Myinifile : TIniFile;
Begin
//membuat file INI bernama “Seting.ini”
MyInifile := TInifile.Create(GetcurrentDir + ‘\Seting.ini’);
//Mencatat posisi Form1.Top
Myinifile.WriteInteger(‘Posisi’, ’Top’, Form1.Top);
//Mencatat posisi Form1.Left
Myinifile.WriteInteger(‘Posisi’, ‘Left’, Form1.Left);
Myinifile.Free;
End;
Procedure TForm1.Button2Click(Sender: TObject);
Var
INIFileName : TFileName;
OpenedINIFile : TIniFile;
Begin
//Menentukan path dan nama File INI yang di buka
INIFileName := ExtractFilePath(Application.Exename) + ‘Seting.ini’;
//Membuka File INI
OpenedINIFile := TIniFile.Create(IniFileName);
//Menentukan posisi Form1.Top sesuai dg data pada file INI
Form1.Top := OpenedINIFile.ReadInteger(‘Posisi’, ‘Top’, 0);
//Menentukan posisi Form1.Left sesuai dengan data pada file INI
Form1.Left := OpenedINIFile.ReadInteger(‘Posisi’, ‘Left’, 0);
OpenedINIFile.Free;
End;
End.

VIEW PDF DOCUMENT IN DELPHI

VIEW PDF DOCUMENT IN
DELPHI
Basicly to view the PDF document or to manage the PDF Document we need the new VCL that not provide by Delphi.
But if you needed the VCL there is the list of link componen for download to get the PDF VCL, so have nice surf and download

1. PDF In-The-Box

PDF In-The-Box for Delphi is a VCL component that works like Delphi's TPrinter but creates a PDF file! No printer driver to install, no intermediary file to create, no conversion to do, no need of knowing anything about PDF structure. Just an easy-to-use API to write text and draw grids and graphics.

2. ISEDQuickPDF

Here are some features: Built-in barcode support, Import and append to any existing PDF file, Encryption and decryption (including 128-bit encryption), Advanced drawing, including circles and arcs, Page cloning technology, PDF merging technology...

3. PDFReport XP

PDFReport XP is an ActiveX component for Delphi developers who need to programmatically create PDF files easily and reliably, and it comprehends a Free Runtime for your applications.
Vendor's Site (www.dreamscape.it)

4. PDF Creator Pilot

Library can produce PDF documents using given text, pictures and metafiles. You can use library's commands as well as WinApi functions. PDF security, font embedding, different font charsets, document compression are also supported.

5. PDF Forms Toolkit Component

Drop the PDF Forms Toolkit Component on a form and have access to your PDF form directly from Delphi. PDF Forms Toolkit Component is a visual component that works with your copy of Adobe Acrobat version or any Acrobat exchange product.

6. WPDF

wPDF converts enhanced metafiles to PDF while preserving the vector and text information. This results in small PDF files which can be printed at high resolution.

7. Gnostice PDFtoolkit

A powerful component set that helps manage PDF documents from within application programs. PDFtoolkit supports filling and reading of PDF forms, compressing, securing, appending and merging of multiple PDF documents, stamping, building Table of Contents, setting bookmarks, and many more functions that can be performed on PDF documents.
From Zarko Gajic,
Delphi.about.com


(08/Februari/2007; 0:26)

USING AUTOMATIC PRINTING IN DELPHI

USING AUTOMATIC PRINTING IN
DELPHI
It mean print without using the VCL Component like Quick report, Fast Report etc.
We will need the unit printers (printers.tpu), Delphi alredy have it, so just add in the uses section in your unit worksheet.
First we should check or detect the default printer wich attach at the system PC.
The way to detect is using the detect function listed bellow :

//printer detection
implementation
Uses printer; //tambahkan unit printers di bagian uses
Function DapetinPrinterDefault : boolean;
Begin
If (Printer.printerindex > 0) then
Result := true
Else
Result := false;
End;
Where if printing doing when after we click the button on the form so the source code will seem like :
//print data yang mau di cetak
procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
begin
//Deteksi dulu keberadaan Printer pakai fungsi yang dah di bikin di atas
if DapetinPrinterDefault = true then
begin
Printer.BeginDoc;
//print text Belajar Delphi Menyenangkan sebanyak 6 halaman
for I := 1 to 6 do
begin
//100,100 adalah point x,y dimana posisi print akan di mulai pada canvas
Printer.Canvas.TextOut(100, 100, 'Belajar Delphi Menyenangkan');
Printer.NewPage; //pindah halaman baru
end;
Printer.EndDoc;
end
else
showmessage('Ga ada Printer Yang Terpasang');
end;

At above is the listing code the way we print document using atomatic printed from Delphi.
(08/Februari/2007; 0:26)

Download PDF File