Mau konsultasi DELPHI
mungkin aja di bisa di bantu
Telp 62 813.1401.3305
/ 62 817. 910.8005

..<< More Info >>..
Showing posts with label Command Function. Show all posts
Showing posts with label Command Function. Show all posts

Thursday, 19 June 2008

Create Table By Delphi Programe

table77.Close;
table77.DatabaseName := '\SysPro\_Rtxt\';
if directoryexists( 'c:\temp\' ) then
table77.DatabaseName := 'c:\temp\' ;
if directoryexists( 'c:\temp\syspro\' ) then
table77.DatabaseName := 'c:\temp\syspro\' ;

//pomast.orddate, pomast.pono, pomast.vendclass, pomast.vendorid, ');
table77.TableType := ttParadox;
table77.TableName := xfile2;
table77.FieldDefs.Clear;
table77.FieldDefs.Add('PoNo', ftstring, 8, False);
table77.FieldDefs.Add('Orddate', ftdate, 0, False);
table77.FieldDefs.Add('VendClass', ftstring, 4, False);
table77.FieldDefs.Add('VendorID', ftstring, 8, False);
table77.IndexDefs.clear;
table77.IndexDefs.add ('','pono',[ixPrimary]);
//table77.IndexDefs.add ('idex01','bluePRT',[ixCaseInsensitive]);

table77.CreateTable;
table77.Active := true ;

Copy or Append from other table
with delphi command function :



BatchMove1.Destination := table77 ;
BatchMove1.Source := table1;
BatchMove1.mappings.clear;
BatchMove1.Mappings.Add('PoNo=PoNo');
BatchMove1.Mappings.Add('OrdDate=OrdDate');
BatchMove1.Mappings.Add('VendClass=VendClass');
BatchMove1.Mappings.Add('VendorId=VendorId');
//BatchMove1.Mode := batcopy ; //copy table biasa
BatchMove1.Mode := batAppend ; //append table
//showmessage ( batchmove1.mappings.Text+'<<<' ) ;
BatchMove1.execute;

Sample of Function Delphi

d = Decimal (integer)
e = Scientific
f = Fixed
g = General
m = Money
n = Number (floating)
p = Pointer
s = String
u = Unsigned decimal
x = Hexadecimal

Sample of Program format function
var
text : string;
begin
// Just 1 data item
ShowMessage(Format('%s', ['Hello']));

// A mix of literal text and a data item
ShowMessage(Format('String = %s', ['Hello']));
ShowMessage( ' ' );

// Examples of each of the data types
ShowMessage(Format('Decimal = %d', [-123]));
ShowMessage(Format('Exponent = %e', [12345.678]));
ShowMessage(Format('Fixed = %f', [12345.678]));
ShowMessage(Format('General = %g', [12345.678]));
ShowMessage(Format('Number = %n', [12345.678]));
ShowMessage(Format('Money = %m', [12345.678]));
ShowMessage(Format('Pointer = %p', [addr(text)]));
ShowMessage(Format('String = %s', ['Hello']));
ShowMessage(Format('Unsigned decimal = %u', [123]));
ShowMessage(Format('Hexadecimal = %x', [140]));
end;

Result Show :

Hello
String = Hello

Decimal = -123
Exponent = 1.23456780000000E+004
Fixed = 12345.68
General = 12345.678
Number = 12,345,68
Money = ?12,345.68
Pointer = 0069FC90
String = Hello
Unsigned decimal = 123
Hexadecimal = 8C

Cari Uang Dari Internet
Sample of function delphi
Delphi file manipulation
Put your file on line free

Tuesday, 15 January 2008

Delphi file manipulation

You can make forlder, remane forlder, delete forlder, checking folder by delphi command

File function in delphi :

  • checking file is exist or not :

    if FileExists( 'test.xls' )=false then
    showmessage ( "this file is not exist" ) ;

  • checking folder is exist or not :

    if directoryexists( xIsFolder ) then
    showmessage ( "this folder is not exist" ) ;

  • Close windows or program :

    var
    x6h : hwnd;
    begin

    x6h := findwindow(nil,"google - microsoft internet explorer"); // check windows / ie
    if x6h<>0 then postmessage ( x6h,wm_close,1,0); // close windows / ie

    end;
  • Delete file :

    sysutils.deletefile ( pchar('coba.xls') ) ;

  • Rename file :

    renamefile ( 'c:\temp\test1.XLS', 'c:\temp\test77.XLS' );

  • Openning file :

    first add in uses
    uses
    Windows, Messag . . . . . . . . . . . . . . . . . . , Dialogs, StdCtrls,
    shellapi ;

    begin
    shellexecute (handle,'open',pchar( 'c:\temp\text44.txt' ),nil,nil,sw_show) ;
    end;

  • To know the current drive in delphi :

    showmessage ( 'the current drive is ' + GetCurrentDir ) ;

Want to see all delphi command and function Click Here.

Delphi file manipulation

Digg!
Add to Technorati Favorites Join My Community at MyBloglog! Programming Blogs - Blog Catalog Blog Directory online counter
 

Bursa 2000 | Find Better Jobs