Home > Back-end >  Delphi remote database operations
Delphi remote database operations

Time:09-21

Known to the IP address of another computer, how to write the Delphi program realize remote operation of another computer database,

CodePudding user response:

You a great god, and recent topics need to trouble you!

CodePudding user response:

What is the remote database, the operation contains what action

CodePudding user response:

Put a ADOConnection Form, double-click, choose what kind of database, input or drop-down select server, enter account password, the following selected database, test OK, shut down,

CodePudding user response:

It is ok to use DataSnap,,

CodePudding user response:

Mainly through the IP address of the computer, and then read the somebody else computer database, specific how to implement?? For example,

CodePudding user response:

Mainly through the IP address of the computer, and then read the somebody else computer database, specific how to implement?? For example,

CodePudding user response:



This is a remote database connection you

Given IP address, database name, username, password this a few are also to,

Code you find and connect to a remote database has a lot of

MSSQL, for example:
Create a Delphi project,
Drag a Button, ADOConnection ADOQuery, DBGrid, DataSource
Set up associations,

Button click events to connect to the database, and display data from a table Table1,

 

Procedure TForm1. Button1Click (Sender: TObject);
The begin
ADOConnection1. The ConnectionString:='Provider=SQLOLEDB. 1; + '
'Persist Security Info=True; + '
'the User ID=' + User name + '; + '
'the Password=' + Password + '; + '
='+' Initial Catalog database name + '; + '
'Data Source=' + server IP + '; ';
//connection specified database
ADOConnection1. LoginPrompt:=False;
ADOConnection1. Connected:=True;
ADOQuery1. Connection:=ADOConnection1;//connected data
With ADOQuery1 do//use ADO component connection data table
The begin
close;
SQL. The Clear;
SQL. The Add (' Select top 100 * from Table1 ');//using SQL query data in the table content
The open;
end;
ADOQuery1. Active:=True;
DataSource1. The DataSet:=ADOQuery1;
DBGrid1. The DataSource:=DataSource1;
end;

CodePudding user response:

Port 1433 to the insinuation of the network

CodePudding user response:

With three layers, direct words later turn the network access more troublesome

CodePudding user response:

http://blog.csdn.net/pcwe2002/article/details/52527782
This kind of solutions to direct speed slow, not safe, easy to drop, the code also does not need to be modified,

CodePudding user response:

The
reference 4 floor lyhoo163 reply:
use DataSnap,,

If your not fixed IP can through the establishment of VPN special line connection,

CodePudding user response:

Can be connected through the three layer, can also be private network connection can also be normal
  • Related