[Delphi Technology] (SQL DBE, ADO Connection) + (Firebird Fire bird +dbexpress) + (VF DBF database) + (DB Paradox)

Source: Internet
Author: User
Tags db2 transaction dbase odbc paradox database

DBE

Connecting SQL Server is obviously more advantageous with ADO or dbexpress, at least it is convenient to connect.

BDE words can be used as follows: (the following take Delphi7 as an example, other versions of Delphi please feel it, but the basic difference is not big)

1. Start Delphi, select menu item Database->explorer, right-click on the Database list on the left, select New, select MSSQL in the Popup driver dialog box, OK, then on the left can change the name, such as: TEST, Then check test to add servername (server name) UserName (login name) DatabaseName (database name) in the right option

Then apply and close

2. Add a database control to the form and right-click Database to select the database Editor ...

Add the name of the database in Delphi, the database alias, and the parameter

USER Name=sa

password= your password.

Save return

3. Set database's loginprompt to false,connected to True

Normal, you have been connected to SQL Server, this is not too much trouble, mainly distributed time will be more effort, so it is best to use ADO to connect better.

Ado

The simplest way

Put a ADOquary1, Dbgrid1, DataSource1.

Set ADOquary1 's Connect or ConnectString properties to connect to your database

write in SQL attribute (SELECT * from "Table")

The DataSource1 DataSet property is set to Adoquary1,dbgrid1 datasource is set to DataSource1, and the active property of Adoquary is changed to true to run the result.

Firebird Fire Bird +dbexpress (the library suffix is *.) DB)

1.tsqlconnection1-tsqldataset1-tdatasetprovider1-clientdataset1-datasource1

(A few controls are all property-connected, the first connected to the library with code.) )

Procedure Tform1.formcreate (Sender:tobject);
Begin
If Sqlconnection1.connected=true Then
Sqlconnection1.connected:=false;
SQLConnection1.Params.Clear;
sqlconnection1.params.values[' user_name ']:= ' sysdba ';
sqlconnection1.params.values[' password ']:= ' masterkey.pub ';
sqlconnection1.params.values[' Sqldialect ']:= ' 3 ';
sqlconnection1.params.values[' database ']:=extractfilepath (PARAMSTR (0)) + ' DATA. DB ';
Sqlconnection1.connected:=true;
End

Procedure Tform1.button1click (Sender:tobject);
Begin

With SQLDataSet1 do
Begin
Close;
Commandtext:= ' select * from Torderf ';
Open;
End

Clientdataset1.active:=true;

End

To publish a program:

1. Midas.dll into the C:\WINDOWS\system32. In execution, execute the regsvr32 C:\WINDOWS\system32\midas.dll. Registered

2.EXE program must have Dbexpint.dll, GDS32 in the same directory. DLL two files.

3. FBWin32.exe must be installed on the computer.

DB2 Transaction Processing Method (Delphi version)

1. Reference Unit

Uses dbxpress;

2. Defining transactions

Var

G_td:ttransactiondesc;//mysql transactions

3. Using Transactions

Procedure Tform1.button1click (Sender:tobject);

Begin

G_td.  Transactionid:= 1; MySQL Transaction ID

G_td. Isolationlevel:= xilreadcommitted; MySQL transaction level

Try

Sqlconnection1.starttransaction (G_TD);

...

...

Sqlconnection1.commit (G_TD);

Except

Sqlconnection1.rollback (G_TD);

End

End

VF DBF Database

Connecting DBF data
Constructing ADO Connection string
Provider Select Microsoft Jet 4.0 OLE DB Provider
"All" there edit Extended Properties,
DBF file is set to dBASE 5.0 (note that there must be spaces between dBASE and 5.0, preferably copy past paste)
DB file set to Paradox 7.X
(DBF is a dBASE or Vfox database, DB is the Paradox database)
The "database name" entered in the "Connection" is a directory name and cannot contain a file name.
For example, if your file is c:\temp\aaa.dbf, enter C:\Temp
At the same time CursorLocation is set to: Cluseserver

also:
If you connect directly, ADO's connection string is set to:
Adoconnection1.connectionstring:= ' provider=msdasql.1; extended   properties= "driver={microsoft   visual   Foxpro   Driver}; SOURCETYPE=DBF; Sourcedb=c:\mydb "';
If you are using ODBC, first set up a DSN in ODBC to connect to the DBF library, and then set up the connection string connected to ODBC in ADOConnection (you can do it with the wizard)

db paradox  (Database for Delphi Generation)
with Con1 do
begin
    Connected: = False;
    ConnectionString: = ' provider=microsoft.jet.oledb.4.0; User Id=admin;data source=f:\pakagetest; Mode=share Deny None; Extended Properties=paradox 7.X; Persist Security Info=false ';
    loginprompt: = False;
    Connected: = True;
End;

Qry1.close;
Qry1. Sql. Text: = ' select * from INF ';
Qry1. Open;
Attention:
If it appears on your computer, you cannot use it. is the driving problem. Check if "Hkey_local_machine\software\microsoft\jet\4.0\isam formats\paradox 7.X" is present, if not present, the driver version is incorrect.
Latest jet4.0 Download
http://support.microsoft.com/default.aspx?scid=kb;zh-cn;239114

[Delphi Technology] (SQL DBE, ADO Connection) + (Firebird Fire bird +dbexpress) + (VF DBF database) + (DB Paradox)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.