Link to home
Start Free TrialLog in
Avatar of mis82
mis82

asked on

Small local database

hello
i need a small small DB   a small table to add three columns , and then to compare  a strings in each columns items  and how can i delete and use for loop to compare
the strings .
Avatar of sftweng
sftweng

Depending upon your Delphi version, (Pro or above ) you would be able to use TClientDataSet to read a binary (or xml) based table from a local file. In memory, you can easily perform searches, deletes updates etc. and then update the file.

If you have to use Delphi Personal, you can use ADO to create a JET mdb database (MSAccess format) and do the same things that way.

What is your version of Delphi?
Avatar of mis82

ASKER

Delphi 7 pro
You might like to look at one of the Delphi demo projects, in %DELPHI%\Demos\DB\TextData. It uses a TDataSet and a TDBGrid.
http://firebird.sourceforge.net/

Firebird is a commercially independent project of C and C++ programmers, technical advisors and supporters developing and enhancing a multi-platform relational database management system based on the source code released by Inprise Corp (now known as Borland Software Corp) under the InterBase Public License v.1.0 on 25 July, 2000.
OK: the next question is: do you need a multiuser database, because it's web application or a client-server system that shares the database, or is it a single user application.
If the latter, then I would pick one of the many classes available to just link directly into the application.

Following up on the Delphi examples: there should be a demo for TClientDataSet using an XML file as the datasource under $(DELPHI)/Demo/DbCLX/MyBaseExplorer

In fact, all the other demos under the dbclx directory are equally useful, but they use the other format TClientDataSet supports, which is a binary file with a .cds extension.
If you want to use xml instead of the binary format, just add a button to save the TClientDataSet as xml - look up the method in the help. You can then load from the xml file.



Avatar of mis82

ASKER

No i dont want a multi user database  , i need only local and small databsae
add and modify and delete and compare and save values rows and columns
something simple
TClientDataSet:

TClientDataSet implements a database-independent dataset.

Unit

DBClient

Description

TClientDataSet represents an in-memory dataset. A client dataset can be used as

A fully-functional, stand-alone, file-based dataset for single-tiered database applications. When used in this manner, the client dataset represents the data stored in a dedicated file on the user’s hard disk.
      A local in-memory buffer of the records from another dataset. The other (source) dataset can reside in the same form or data module as the client dataset (for example, when the client dataset provides navigation and editing support for the data from a unidirectional dataset). The source dataset can also reside on a separate system when the client dataset supports the client portion of a multi-tiered database application.

Note:      The two functions described above are not mutually exclusive. An application can be designed to support the option of working with data offline, using the “briefcase” model. On site, the application uses TClientDataSet to communicate with the database server associated with a source dataset. When a user works off site, the client dataset writes a snapshot of the data to the hard disk.  The application works with this snapshot off site, with the client dataset acting as a file-based dataset in a single-tiered application.

When a client dataset represents the data from another dataset, it communicates with that dataset through a dataset provider. The client dataset communicates with this provider through the IAppServer interface. When the provider is in the same form or data module as the client dataset, the IAppServer interface is implemented by a hidden object that is created for you. When used in a client application as part of a multi-tiered application, the client dataset passes all calls to the provider through a remote data module’s IAppServer interface.

TDBGrid:

TDBGrid displays and manipulates records from a dataset in a tabular grid.

Unit

DBGrids

Description

Put a TDBGrid object on a form to display and edit the records from a database table or query. Applications can use the data grid to insert, delete, or edit data in the database, or simply to display it.

At runtime, users can use the database navigator (TDBNavigator) to move through data in the grid, and to insert, delete, and edit the data. Edits that are made in the data grid are not posted to the underlying dataset until the user moves to a different record or closes the application.

TDBGrid implements the generic behavior introduced in TCustomDBGrid. TDBGrid publishes many of the properties inherited from TCustomDBGrid, but does not introduce any new behavior.
Can you post your database "schema", the list of fields, their lengths and types? You original question left me a little confused - do you have three numeric fields whose values are to be summed (added)?

To iterate through the data, all you have to do is create a "for" loop that goes through the rows of the TDBGrid. What do you want the string comparison to do?
Avatar of mis82

ASKER

username password    address
   aaa          xxxxx       192.168.0.1
   bbb          ooooo      192.168.0.2
   ccc          llllllllllll       192.168.0.3

i mean strings and maybe i will use some integer values
thats all
Avatar of mis82

ASKER

any help?
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial