Thursday, August 28, 2014

Step by Step Making Management System Software

If you work as a programmer in a company, then you probably got a task to make a Management system software for your company. In some company, we will do this task as a team with our co-workers, but sometimes we must do it alone. A company that really want to press their budget usually do this, just like my company. And here, in Indonesia, almost every companies that hire a programmer do this. For you that got a task like this and don't know how to start, here are step by step to do it :

Analyze The Problem

If we work as a team, this work is actually for Systems Analyst. We must analyze the problems that happen in our company mangement systems. Find every problems that exist and try to solve it. After we found the problems, we must specify everything that we need to solve this problem. We must define the technology that we will use. Define what database system we must use. Define the flows from the systems. We can define it by create flowcharts or diagrams.




Database Design

After analyze the problem, now we know what technology that we will use. For database, we can choose what we will use. Is mySQL, Firebird, Oracle, or another database system. Make a list for tables that we need for systems. For example, if we want to make Payroll system, define all data that we need for this system. Specify the relation between tables if it needed.


Make Interface

Create program interface for software that we will build. Make this interface is easy to use for our users.

Coding

Now it's time to write code for our Management System Software. Don't forget to make documentations. These documentations will very helpfull for us if one time we want to make changes on our system.

That's all Step by step Making Management System Software from me. If you have another opinions or you have an experience making it, let me know it.
read more

Saturday, June 14, 2014

Connecting Delphi with SDF (Sql Compact) Database using ADO

This Delphi Tutorial will show how to connecting Delphi with SQL Compact Database using ADO.


To connecting ADO with SDF file, first we must install Sql Compact on windows. We can download it here for Sql Compact 3.5 SP2.

After we install it, go to registry editor. Windows -> Run -> type "regedit".

find this key : HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{F49C559D-E9E5-467C-8C18-3326AAE4EBCC}

(this was in the Windows 7 PC. In the other one it was HKEY_CLASSES_ROOT\CLSID\{F49C559D-E9E5-467C-8C18-3326AAE4EBCC} )

Then, I add a new key into in: "OLE DB Provider". And finally, set the default value of this key to "Microsoft SQL Server Compact OLE DB Provider".
Registry SQL CE OLE DB Provider
Now, ADO will shows this provider on the list and we can select it.

Open our delphi project, add These components :
- ADOConnection
- ADODataSet
- ClientDataSet
- DataSetProvider
- DataSource
- Table Grid (i'm using cxGrid)

fill this connection string on ADOConnection :
Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=D:\BBlocksStock\test.sdf;Mode=ReadWrite;SSCE:Max Buffer Size=4096;SSCE:Database Password="";SSCE:Encrypt Database=False;SSCE:Default Lock Escalation=100;SSCE:Temp File Directory="";SSCE:Default Lock Timeout=5000;SSCE:AutoShrink Threshold=60;SSCE:Flush Interval=10;SSCE:Test Callback Pointer=0;SSCE:Max Database Size=256;SSCE:Temp File Max Size=128;SSCE:Encryption Mode=0;SSCE:Case Sensitive=False;

change Data Source value with your database path.

set ADODataSet Connection with ADOConnection. Fill the ADODataSet CommandText with SQL Select Command. ex : SELECT * FROM TEST

set DataSetProvider DataSet with ADODataSet.
set ClientDataSet Provider Name with DataSetProvider
set DataSource DataSet with ClientDataSet.

now on Form onCreate event, write this code :
procedure TForm1.FormCreate(Sender: TObject);beginADODataSet1.Active:=true;end;
if it run correctly, data from database will show on table grid component.
Connecting Delphi with SDF SQL CE

Why we use ADODataSet?? I try use ADOTable Component, and when i try to select TableName properties, we will get error "Multiple-step OLE DB operation generated errors.Check each OLE DB status value, if available. No work was done."

We use ClientDataSet for database transaction. i try to insert new data using ADODataSet Component, i always get error.
so we use ClientDataSet Component for database data transactions.
This is example code for insert new data :
procedure TForm1.Button1Click(Sender: TObject);
begin
ClientDataSet1.Append;
ClientDataSet1ID.AsInteger := 13;
ClientDataSet1.ApplyUpdates(-1);
ADODataSet1.Active:=false;
ADODataSet1.Active:=true;
ClientDataSet1.Active:=false;
ClientDataSet1.Active:=true;
end;

read more

Thursday, June 5, 2014

Get Column Value from CxGrid Multiselect (DevExpress)

For this Delphi Tutorial, i will write the code how to get value from a column for the data that we select. In this Case, we can select data more than one, and then get the values from a column from data that we select.

first step, make an application with button, cxgrid component, and database Components.
this is for example :

Don't forget to enable Multiselect option on cxGridDBTableView OptionSelection :


Then, write this code on Button OnClick event :
procedure TForm1.Button1Click(Sender: TObject);var i : integer;    s : String;
begin
for i:=0 to cxGrid1DBTableView1.Controller.SelectedRowCount - 1 do   
begin
showmessage(cxGrid1DBTableView1.Controller.SelectedRows[i].Values[0]);
end;
end;
Try to run the application, click the button, and see the result.
If this code run perfectly, the application will show value from column for data that we select.

SelectedRows[i] mean index for data that we select.

Values[0] is index for column. For this code, we will get value from Column ID, since it index is 0. You can change the index base on column you want to get the value.

read more

Friday, May 23, 2014

Learning Delphi for First Time

Like other Programming Language, we will learn how to make 'Hello World!' project with delphi.
for this Delphi Tutorial project, i will use 3 methods :
1. Using Edit Text and Button
I assume we already open Delphi application and we see a form for us to build the project.
First Step , add Edit Text and Button component. You can find Edit Text and Button Component at component tool bar. Here is the picture :
To add the component, simply click the component, and then click again on the Form. Set the position of the component. You can set the component like this or you can set it with your own :

After we set the component position, now we add command on Button component. This command will make Edit Text component write 'Hello World' when we click the button component.
To add that command on Button component, click Button component, and then at Object Inspector (usually it place at bottom left Delphi application). Click on 'Event' tab, and double click OnClick. 
After we click Event OnClick, now we put our command here :
 the command should write like this :

procedure TForm1.FormClick(Sender: TObject);
begin
Edit1.Text := 'Hello World!'
end;

Now, run our Project. 

Click the Button, and see the result..

2. Using Button and ShowMessage command.
Add Button component to Form. And then, on Button OnClick Event, add this command :
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage('Hello World!');
end;

now Run the project, click the Button, and see the result..

3. Using Button and Label Component.
Now try to add Button and Label Component to the Form.

set position for Button and Label on Form.
Now, on Button OnClick event, write the code like this :

procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption := 'Hello World!';
end;

Run the project, and try to click the Button. See the result..

read more

Wednesday, May 21, 2014

Delphi Introduction

From wikipedia, delphi is an integrated development environment (IDE) for console, desktop graphical, web, and mobile applications.
Delphi's compilers use their own Object Pascal dialect of Pascal and generate native code for 32- and 64-bit Windowsoperating systems, as well as 32-bit Mac OS X, iOS and Android. As of late 2011 support for the Linux operating system was planned by Embarcadero.

Delphi was originally developed by Borland as a rapid application development tool for Windows, and as the successor of Borland Pascal. Delphi and its C++ counterpart, C++Builder, shared many core components, notably the IDE and VCL, but remained separate until the release of RAD Studio 2007. RAD Studio is a shared host for Delphi, C++Builder, and others.

(source : http://en.wikipedia.org/wiki/Embarcadero_Delphi)

read more