tadodataset

How to use a RecordSet.Find with TADOQuery?

早过忘川 提交于 2019-12-24 17:39:50
问题 In this question: Delphi ADO : Locate with dataset filter on bug an ADO bug was described where the Filter string is ignored during .Locates. This is causing problems for us migrating from the BDE because we have a lot of code that changes the filter according to user input. We had expected TADOQuery to provide a working migration path. We were wrong. We can of course change our current filters to WHERE statements, but that's a lot of work and risk concatenating the filter strings to filter

Destroying TADODataset created in runtime

荒凉一梦 提交于 2019-12-11 21:20:03
问题 I have a function that returns a TADODataset object: // inside DataModule: function TDM.GetWorkstationsList: TADODataset; var DS: TADODataSet; begin DS := TADODataSet.Create(nil); DS.Connection := MyConnection; // MyConnection is TADOConnection DS.CommandType := cmdText; DS.CommandText := 'SELECT * FROM Workstation'; DS.Active := True; Result := DS; end; This is how I plan to use it: // inside main form: tvWorkstation.DataController.DataSource.DataSet := DM.GetWorkstationsList; //

how to export TADODataSet with Fields Texts not Fields Values

百般思念 提交于 2019-12-11 08:06:48
问题 I have a TADODataSet connected with a stored procedure which produce 40 Columns * 800 Row the TADODataSet has an AfterOpen event which assign an OnGetText for it is Fields like : procedure TForm1.ADODataSet1AfterOpen(DataSet: TDataSet); begin with DataSet do begin Fields[4].DisplayLabel:=TR(AS2); //RefId Fields[4].DisplayWidth:=8; Fields[4].Tag:=1; Fields[4].OnGetText:=RefGetText; Fields[5].DisplayLabel:=TR(AS3); //ClientId Fields[5].DisplayWidth:=8; Fields[5].Tag:=1; Fields[5].OnGetText:

ADODataset: how to load XML (saved beforehand in DB in ADO schema) data without temporary files?

↘锁芯ラ 提交于 2019-12-08 04:36:08
问题 Warning: total rewrite. Scenario: I loaded some data from database on a TCustomADODataset descendant. After that, I saved this data on XML temp file (using TCustomADODataset.SaveToFile) to allow getting the XML data as a string and store it on a database table as text blob - it's an exports table. Another program (different from the one that stored the XML) will take that data, show the elements inside, and allow an user to select which element to import to the main database schema. Problem:

ADODataset: how to load XML (saved beforehand in DB in ADO schema) data without temporary files?

こ雲淡風輕ζ 提交于 2019-12-07 02:59:26
Warning: total rewrite. Scenario: I loaded some data from database on a TCustomADODataset descendant. After that, I saved this data on XML temp file (using TCustomADODataset.SaveToFile) to allow getting the XML data as a string and store it on a database table as text blob - it's an exports table. Another program (different from the one that stored the XML) will take that data, show the elements inside, and allow an user to select which element to import to the main database schema. Problem: The problem with the approach above is the need of temporary files to allow TCustomADODataset use the

ADO components CommandTimeout

荒凉一梦 提交于 2019-12-01 04:11:02
I have a problem with settings of the query execution timeout with TADOQuery, TADOCommand or TADODataSet (I've tried it with each one). I have a tiny application, which connects to the database and periodically executes stored procedures, which returns dataset as a result . My aim is to keep this application always online, but my problem is that when the connection is lost, the timeout of just executed command (through the one of the mentioned components) takes the default 30 seconds. I've been looking for the solution, but nothing works. Could you give me an advice, how to set the

ADO components CommandTimeout

笑着哭i 提交于 2019-12-01 01:20:08
问题 I have a problem with settings of the query execution timeout with TADOQuery, TADOCommand or TADODataSet (I've tried it with each one). I have a tiny application, which connects to the database and periodically executes stored procedures, which returns dataset as a result . My aim is to keep this application always online, but my problem is that when the connection is lost, the timeout of just executed command (through the one of the mentioned components) takes the default 30 seconds. I've

How to achieve independent cloned TADODataSet?

二次信任 提交于 2019-11-30 23:03:24
The scenarios is like this: We have some SQL table. We are performing an SQL query on this table and we have results in TADOQuery object. var qryOryginal, qryClone: TADOQuery; begin //setup all the things here qryOryginal.Active := True; qryClone.Clone(qryOryginal, ltBatchOptimistic); qryOryginal.Delete; //delete in qryOryginal casues that qryClone deletes its record too! end; So, after cloning the DataSet my qryClone should hold and independent data(at least I thought so). However, performing Delete on qryOryginal causes the same operation on the qryClone. I don't want that. Any ideas? I know

How to achieve independent cloned TADODataSet?

大兔子大兔子 提交于 2019-11-30 17:32:26
问题 The scenarios is like this: We have some SQL table. We are performing an SQL query on this table and we have results in TADOQuery object. var qryOryginal, qryClone: TADOQuery; begin //setup all the things here qryOryginal.Active := True; qryClone.Clone(qryOryginal, ltBatchOptimistic); qryOryginal.Delete; //delete in qryOryginal casues that qryClone deletes its record too! end; So, after cloning the DataSet my qryClone should hold and independent data(at least I thought so). However,

ADODataSet deleting from joined table

为君一笑 提交于 2019-11-30 14:43:15
I have a Delphi app where I display a list of games that have been played from a query like this: select g.*, gt.id, gt.descr from GAMES g inner join game_types gt on gt.id = g.game_type order by game_date DESC When I click the delete button in the DBNavigator, the joined record from the game_types table is also deleted. That's a problem because many other games can be of the same type. What do I need to do to make it so that only the game is deleted but not the game type? You need to use the Unique Table dynamic property ADOQuery1.Properties['Unique Table'].Value := 'GAMES'; From the MSDN ADO