<< Click to Display Table of Contents >> General Questions |
The list of general questions and answers.
A: ADO.Net VCL for Delphi Trial version: •does not include the library source code files. •30 days limitation period. |
A: Yes, it has. In general, connection pool minimizes the cost of repeatedly opening and closing connections. Connection pooling is handled differently for each of the data access components of the ADO.Net VCL for Delphi. When the connected property of the descendant of TDbConnection is set to True, the ADO.Net takes a "physical" connection from the pool and uses it. When the connected property of the descendant of TDbConnection is set to False, the "physical" connection is not closed, but put back into pool.
To use connection pooling in ADO.Net VCL, set the pooling property of the DAC Connection's Params property to True. E.g. For SqlClientDAC, set the pooling to true like the code below: TSqlClientConnection.Params.Pooling := True; |
A: 1) Using SqlClientDAC:
uses
CNClrLib.ADONet.SqlClient;
var
msg: string;
begin
try
// ....Connect to Database and execute a query....
except
on E: Exception do
begin
if E is ESqlClientException then
begin
msg := 'Server: ' + ESqlClientException(E).Errors[0].Server + #13#10 +
'Line Number: ' + IntToStr(ESqlClientException(E).Errors[0].LineNumber) + #13#10 +
'Number: ' + IntToStr(ESqlClientException(E).Errors[0].Number) + #13#10 +
'Message: ' + ESqlClientException(E).Errors[0].Message;
ShowMessage(msg);
end
else
ShowMessage(E.Message);
end;
end;
end.
|
2) Using OdbcDAC:
uses
CNClrLib.ADONet.Odbc;
begin
try
// ....Connect to Database and execute a query....
except
on E: Exception do
begin
if (E is EOdbcException) and (EOdbcException(E).ErrorCode = 335544472) then
ShowMessage(strUserUnkown) // your Errormessage
else
ShowMessage(E.Message);
end;
end;
end.
|
A: TOdbcQuery is the mix of the TOdbcDataReader, TOdbcDataAdapter, DataSet and few TOdbcCommand's. So, the TOdbcQuery has everythings inside to execute SQL command, send parameters data, receive and stored result sets, browse result sets, post changes back to a DB. There is no reason to use TOdbcQuery + DSP + CDS.
You can use TClrMemTable, TOdbcDataAdapter and TOdbcCommand directly, instead of TOdbcQuery. It gives more flexibility. But it also requires more coding.
TOdbcQuery is optimal "shortcut" for every day data application programming.
Note: •Other ADONet VCL Query Components are TSqlClientQuery, TOracleClientQuery, TSQLiteQuery and TOleDbQuery. •Other ADONet VCL DataReader Components are TSqlClientDataReader, TOracleClientDataReader, TSQLiteDataReader and TOleDbDataReader. •Other ADONet VCL DataAdapter Components are TSqlClientDataAdapter, TOracleClientDataAdapter, TSQLiteDataAdapter and TOleDbDataAdapter. •Other ADONet VCL Command Components are TSqlClientCommand, TOracleClientCommand, TSQLiteCommand and TOleDbCommand. |
A: You does not need to define Indexes, if you just need to order data. IndexFieldNames will work for you. |
A: Use the following code:
|
A: Assign an expression to the TField.DefaultExpression property. |
•FAQ