Sunday, 2 February 2014

Q ) Explain about DPR ?


Ans.Apart from two important files (PAS and DFM) there is a third file known as (DPR) or Delphi project file. Delphi project file is automatically built by the compiler. There are two ways to edit the file one is through manually and the other is through Delphi project manager. The source file which you will be seeing is a Pascal source file. 
Q) What is the use of UDL files in Delphi?
Ans. If you want to store the server connection information outside the application which can be retrieved later during connecting time. This is very useful in creating UDL files which are very helpful where hard coded connection string is not acceptable. Also try to save the documents in the form of .udl which will help you to connect databases easily.

Q) What is the procedure to access the database from Delphi ?

Ans. - To access the database the BDE needs to be configured as it defines an alias for the database that has to be connected. 

- The configuration allows the avoidance of coding the directory path and it just takes the referring of the alias. 

- The creation of three objects is required to access the database and that includes: Query or table object that in synchronization with the alias and it also fetches some data. 

- Data source object that allows the linking between the data and the controls used to connect the database. 

- Setting the active property on the table or query to TRUE will open the database and allow the accessing to be done.

Thursday, 18 July 2013

what is TADOQuery component for Delphi?

TADOQuery component is aimed at execution of SQL-commands. It can be considered as an analog of TSQLQuery component from dbExpress. Connection to the database is set via Connection or ConnectionString properties. Query text is written to SQL property. If a query returns the dataset one should use Open() method or Active=true property. If a query does not return the dataset, it shall be run using ExecSQL method. ExecSQL returns the number of records processed during a query running. The same value is contained in RowsAffected property.

Wednesday, 17 July 2013

What is TADOConnection in Delphi

TADOConnection component connects to the data storage. TADOConnection resembles TSQLConnection component. The difference between them is that when working with TSQLConnection connection parameters are set via ConnectionNameDriverName and Paramsproperties. In TADOConnection all connection parameters are set via ConnectionString property. Moreover, it is possible to specify file name with connection parameters as a connection string in TADOConnection.

Connection String with Firebird database in Delphi XE2

procedure TForm1.Button1Click(Sender: TObject);
var 
 Conn: TSQLConnection;
begin
  Conn := TSQLConnection.Create(Self);
  try
    Conn.DriverName := 'Provider=MSDASQL.1; '+
                       'Persist Security Info=False; '+
                       'Data Source=DataBaseName; '+
                       'Initial Catalog=DataBaseName';'; 
    Conn.Params.Add('User_Name=SYSDBA');
    Conn.Params.Add('Password=masterkey');

    // Replace the dbname in the next line with the
    // value obtained at runtime, as  in
    // Conn.Params.Add('Database=' + YourNewPathAndDBName);
    Conn.Params.Add('Database=D:\FolderName\DataBaseName.fdb');

    Conn.Open;
    if Conn.Connected then
      ShowMessage('Connection successfully made to DB');
  finally
    Conn.Free;
  end;
end;

Monday, 8 July 2013

Q :- What is the difference between the SuperServerclassic and embedded servers ?

Ans:-SuperServer is a single-process multi-threaded server (like Apache on Windows, for example) Classic is a multi-process single-threade server - things are synced via a separate lock manager process Embedded is a DLL you hook up to your application and work with database file directly
SuperServer is good for OLTP, lot of users, etc. Classic is good for OLAP or few users running heavy queries. Embedded is good for desktop apps.
You should install and use SuperServer while developing, since embedded only allows one connection at a time, so you cannot access the database from your application and administration tool at the same time. Later, you can deploy using any of those 3 architectures.