?
Solved

use ADODataSet

Posted on 2003-03-03
10
Medium Priority
?
483 Views
Last Modified: 2010-04-04
hi all,

I use a update command in ADODataSet....

But it bring an error 'ADODataSet:commandtext does not return a result set' when I try ADODataSet.open

When I open the database,I found the update sql command is successful.

How to avoid the error popup?

who can help me? :) tks!
0
Comment
Question by:li_fang
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 3
  • +1
10 Comments
 
LVL 21

Expert Comment

by:ziolko
ID: 8062885
ADO queries which dont return data should be called through TADOCommand or thereis possible workaround:
after update statement add dummy SQL like: select a=1. When useing TADODataSet or TADOQuery SQL statement must return at least 1 row.
ziolko.
0
 
LVL 17

Accepted Solution

by:
geobul earned 400 total points
ID: 8062893
Hi,

Use TADOQuery instead. Call its ExecSQL method. Open method must be used when the SQL statement returns a result set only. Use the optional lines below if you want to create the SQL statement in run-time.

with ADOQuery1 do begin
  Close;
  SQL.Clear; // optional
  SQL.Add('UPDATE ...); // optional
  ExecSQL;
end;

Regards, Geo
0
 
LVL 3

Expert Comment

by:sfock
ID: 8063069
geobul

The use of TADOQuery, TADOStoredProc and TADOTable is not recommended. Borland has created this tree components to make it easier to migrate a project from BDE to ADO. After especially in Delphi5 these components have been very buggy and their arcitecture does not meet the arcitecture of ADO they should not be used if not nessesary.
The TADODataset and TADOCommand components are nothing but wrappers around the "original" COM Objects. For this reason it is most likely that there will be not "additional" problems occur when you use these.
Unless your solution will work perfectly, ziolko's TADOCommand solution is the "better" way to do it.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 17

Expert Comment

by:geobul
ID: 8063138
Let me disagree. I've been using Delphi 5 ADO components for years. TADOQuery and TADODataSet are both direct descendants of TCustomADODataSet, which is actually that 'wrapper' you are talking about. Yes, there was a bug when Delphi 5 was initially released but it was fixed in the first patch.

Regards, Geo
0
 
LVL 3

Expert Comment

by:sfock
ID: 8063374
geobul:

Well after you are right, that bugs i was talking about have been patched. Sorry i forgot to say. But after my intention has not been to say that TADOQuery would be "very buggy" this is not the point.
The main point is the different arcitecure. The fact that you can't take full advantage of ADO with a BDE Component architecture. I am sorry if this was not clear in my first posting.

Anyhow, like you i have also been using this components for years. And like you i prefer the ADOQuery to the ADODataset, but there are no good reasons for it except:
-You want to migrate from ADO to BDE or opposite
-You want to keep open to use both ways (why ever)

Anyhow i have to agree, that my point is not really important if you need ADO "only" to retrieve some data.

And let me say sorry i have not been intended to attack you in any case.
0
 
LVL 21

Expert Comment

by:ziolko
ID: 8063435
Hey guys if You really want to use "core ADO" You should use ADODataSet1.Recordset or even interfaces exposed by Microsoft:-)
ziolko.
0
 
LVL 17

Expert Comment

by:geobul
ID: 8064114
sfock, I haven't ever thought you are attacking me ;-)

We share opinions here trying to help others and learning new things every day (at least I do).

TADOCommand could be used in that case, of course. The fact that I haven't mentioned it doesn't mean that I'm against it.

I'm not sure what you meant by saying:
> The use of TADOQuery, TADOStoredProc and TADOTable is not recommended.

Could you say where you've got this information from? I've never heard anything about this.

Regards, Geo
0
 
LVL 3

Expert Comment

by:sfock
ID: 8064303
geobul
>I haven't ever thought you are attacking me ;-)
OK that's good! ;-)

Well the recomandation comes from Andreas Kosh. He is Author of a lot of Book's and Articles of the Topic Delphi. His latest Books have been "COM/DCOM and COM+ with Delphi" and "ADO and Delphi" After he is a german Author writing for a german publisher, i fear the Books are only available in German.
I would think, i have also read a similar statement on a borland page, but i can't find it anymore. I am sorry.
0
 
LVL 21

Expert Comment

by:ziolko
ID: 8065335
I dont know any recomendations about ADO only recomendation is my experience:-)) and I'm trying to use TADODataSet and TADOCommand to be honest with You I dont remember when I used TADOTable os TADOStoerdProc last time.
ziolko.
0
 

Author Comment

by:li_fang
ID: 8070158
tks for all comments!!!

I have known,that I will use TADOQuery instead .

zioloko's comment is great ! but I only can pay points to only one person:(

BEST REGARDS!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question