Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO & MTS & Delphi

Status
Not open for further replies.

Rotar

Programmer
Jan 9, 2001
17
0
0
SI
I am using ADO in MTS (NT 4 server sp 6a, sqlserver 7) . Do I need (because of transaction control) to use ObjectContext when creating ADO objects
(connection, recordset, command)?

I connect to sql7 using onActivate event with creating adoconnection object.

What do I have to set (in DTC?!) for transactions to work properly (using
setcomplete, setabort)?

I update data with ADOCommand object (Many calls to this object - different clauses). How do I know that all this updates are within one transaction? I want to commit or rollback transaction with call to SetComplete or SetAbort.

Does have ObjectContext any role when using ADO components?

Thanks,
Rotar


 
You donot need ObjectContext to create ADO objects.Using mtsexplore you can set the MTS object's transaction property which will be used by MTS executive.

You can regard ADO as database driver and ADO objects are not MTS objects which donot need ObjectContext.

You can get more help from MTS2.0 online help.

BTW,Why donot you use ADOExpress when using Delphi?

Regards!
zallen@cmmail.com
ICQ:101229409
I want to emigrate Canada or Australia. Any relative information you supplied will be appreciated!

 
Thanks!

I have one more question: I create ADOConnection object on onActivate event and destroy (ADOConn := nil) them on BeforeDestruction event. Is this ok or should I create (and destroy) them inside calling method?

************

BTW,Why donot you use ADOExpress when using Delphi?

Because is wrapper arround mdac 2.1, where is no mechanism for marashalling _Recordset(I thought this was the best solution for marshalling datasets, but now I am looking for solution -- OleVariant XML file(stream)).

Is any VCL component except TClientDataSet that can produce TDataset without any additional DLL (like Midas.dll)?

 
>>I have one more question: I create ADOConnection object on onActivate event and destroy (ADOConn := nil) them on BeforeDestruction event. Is this ok or should I create (and destroy) them inside calling method

If it worked then it is ok.For me i donot Create/Destroy TADOConnection explicitly instead i only connect/disconnect database on Activate/Deactiave event handler


>>Because is wrapper arround mdac 2.1, where is no mechanism for marashalling _Recordset...

I often use OleVariant to package dataset. And as i know ADOExpress can marshal _Recordset but not convenient.

>>Is any VCL component except TClientDataSet that can produce TDataset without any additional DLL (like Midas.dll)?

There are no such VCL componetn built in Delphi.However you can write one or search

Regards!
zallen@cmmail.com
ICQ:101229409
I want to emigrate Canada or Australia. Any relative information you supplied will be appreciated!
 
So, you use MtsDataModule as visual containter for components and then just set (Connection).Active to true/false?
 
Here is a code snippet from one project:
//...
type
TBA_event = class(TMtsDataModule, IBA_event)
cnnHPMS: TADOConnection;
pvdEvent: TDataSetProvider;
dsEvent: TADODataSet;
//...
procedure MtsDataModuleActivate(Sender: TObject);
procedure MtsDataModuleDeactivate(Sender: TObject);
private
{ Private declarations }
protected
public
{ Public declarations }
end;
....
procedure TBA_event.MtsDataModuleActivate(Sender: TObject);
begin
//...
cnnHPMS.ConnectionString := 'FILE NAME=' + DataLinkDir + '\iHPMS.UDL';
cnnHPMS.Connected := True;
end;
procedure TBA_event.MtsDataModuleDeactivate(Sender: TObject);
begin
cnnHPMS.Connected := False;
end;

hope this helps you! zallen@cmmail.com
ICQ:101229409
I want to emigrate Canada or Australia. Any relative information you supplied will be appreciated!

 
Thanks a lot! This is all I want to know...

Bye,
Frenk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top