ADOQuery "Dataset not in edit or insert mode" when higher lev query inserts

I have a series of ADOQueries which all have their Data Sources linked to the query "above" them.  So changing what I am viewing in my highest level query will cascade down and display multiple levels of data.

The problem I am having now is that when I try to perform an insert on my top level Query (using the DBNavigator component) the Query right below it gives the error: 
"ADOQuery2: Dataset not in edit or insert mode".  It throws this error twice and then proceeds to let me enter new information in all queries.  So basically, it does what I want, it just throws up and error first.

I have tried closing the dataset in various "before insert" events, setting its Active property to false, and calling its Edit() function but nothing seems to stop the error.  I even tried catching the Exception at the Application level but it didn't seem to go through there.

Any ideas on how to get this error to stop showing up or, better yet, to fix the underlying problem?
1/9/2013 4:14:46 PM
embarcadero.cppbuilder.using 1848 articles. 1 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 37
Get it on Google Play
Get it on Apple App Store

I was able to find a solution, though I don't think it is ideal.  Setting the Active property to true is the way to go, the only problem is that calling Edit() before hand does not work.  What does work is calling Insert before hand.  I was even able to do this in my top level query's BeforeInsert event.


void __fastcall TForm2::ADOQuery1BeforeInsert(TDataSet *DataSet) 
  ADOQuery2->Active = false;

I'm surprised that Insert turned out to work while Edit would not though.  As far as I can tell I don't want my second query to go into an insert, I just want it to go blank until it gets a value from ADOQuery1 (its datasource).  2 doesn't end up inserting anything, it just waits for 1 to finish.
1/9/2013 8:16:45 PM
> {quote:title=Roberto Sullivinski wrote:}{quote}

> Solution:
> void __fastcall TForm2::ADOQuery1BeforeInsert(TDataSet *DataSet) 
> {
>   ADOQuery2->Insert();
>   ADOQuery2->Active = false;
> }

As an update, I ended up having to remove this.  It caused too many other cascading errors and I had to redesign how my inserts works.
1/22/2013 5:54:45 PM

Similar Artilces:

AJAX Bug? Using UpdatePanels inside a FormView Control - Insert/Edit Modes
So I had a working Formview page, with Edit and Insert modes, each with identical controls (text, labels etc). I decided I wanted to use an Update Panel to update a Text Box with today's date based on the selection of a drop down.Normally with a FormView I can normally have the same Text Box in both the Edit Template and the Insert Template, with the same ID name (txtDate) and everything with no problem....which is helpful/needed for databinding and code-behind methods.But now when I place controls inside the 2 update panel in both Edit and Insert Templates, I get a "txtDate is alre...

Error: "Query: dataset not in Edit mode": in delphi code for Rave Report [Edit]
I am trying to write a Delphi code (Delphi 2010) to print a rave report from the access database; I am using RVSystemprint method; q1 is a query name. I get error message " q1: dataset not in edit or insert mode", at the line: while not q1.Eof. Even though I added q1.Edit or q1.insert, it doesn't work. Database's readonly property is FALSE. What is missing in the code? Thanks. procedure TForm1.rsysPrint(Sender: TObject); begin with Sender as TBaseReport do begin ..... q1.Open; q1.Edit; q1.first; while not q1.Eof do begin ... end; .... ...

Changing "Insert" to "Submit"
When editing a record in detailsview, I am given two links called "Insert" and "Cancel" I would like to change these names. The names do not appear in the source code. Can they be change and if so, how? dover2, When the default value is used for a field it is not displayed in the .aspx page. However you can set it somthing different by including it in the control directive, like so: <asp:CommandField InsertText="Submit" ShowInsertButton="True" />James Hearst.NET Application Developer Hi James, I did as you suggested and "submit" now appears. However, "Insert" and "cancel" also ...

Should "update code lines" and "insert code lines" be same page.aspx or be different (update.aspx and insert.aspx)??
hi friends Should "update code lines" and "insert code lines" be same page.aspx or be different (update.aspx and insert.aspx)? if i use same page.aspx for this, code lines be 1000 lines in page.aspx.vb but one page connect to masterpage... if i use different *.aspx for this, code line be 500 lines in per *.aspx.vb  for per *.aspx... but two pages connect to masterpage.. So i have almost 60 pages (*.aspx).. if i select different *.aspx for update and insert, my pages will be 120 pages (*.aspx) which one should i select ? which one runs high performance ? co...

Using "+" or "||"
Using SQLAnywhere 5.5.04, I've gotten into the habit of using "||" in ISQL to indicate a string concatenation. I needed to paste my SQL statement into the PowerBuilder script painter for some embedded SQL, and PB didn't like the "||" very much at all. I changed it to "+" and it seems to be ok. Do these two operators indicate ~exactly~ the same thing? moin, afaik these two's are not the same! if you're using "||" and any term is NULL then in the resultstring the term will be ignored if you use "+" then the resu...

"Using" or "With"
Hi all Please can someone enlighten to me as regards the difference with the "Using" and "With" statement when accessing data - which is better, what are the limitations and/or any pointers. Many thanks. Regards DaveDavid WinchesterPlease mark as answer if this is the solution.  using gives you the ability to use the connection and it closes the connection directlly after you finish using it. and there is no need to try- cach - finaly. there is no limitation on using USING keywordMuhanad YOUNISMCSD.NETMy Blog || My Photos || LinkedIn I have a dataobject the re...

Matching rows from "inserted" and "deleted"
Hi I am trying to compare rows in inserted and deleted tables after updates to figure out the changes that took place. This works fine if only one row is updated, but how can I match the before and after version of one specific row when there are multiple rows updated? Again, as long as the primary key does not change I have made it work, but what ifthat changes as well. Is there any other indication to which inserted/deleted rows makes a pair? Seems to me that if you're changing primary key values, you've got a design problem. Below is a good definition of a pr...

Why I cannot use "delete" and "edit" functions ???
Hi all,This application was hosted at remote site.  I had a problem when I try to delete or edit or rename  my Album or Photo  after I logged in as  administrator.  I already checked all parameters for matching from both PhotoManager.cs class and all store procedures from Personal.mdf database.  Each parameter is matching each other.  But I still do not know why I got those problems above.  But when I add a new album, it is ok. There is no problem for adding a new album.   I use C# version.  I hosted this application at

Using group to give "edit components" rights and "use for bugs"
I have a product, and I want to give the rights to adminster that product (edit components and so on) to another person. According to the documentation (3.4.4, 3.15), using a group seems to be the proper way to do this, so I created a group for the purpose. Now, the documentation says (section 3.4.4) that "After selecting the "Edit Group Access Controls" link from the "Edit Product" page, a table containing all user-defined groups for this Bugzilla installation is displayed.". So, I did select "Edit Group Access Controls" for the product, and...

Finding "Id" with "Username" selection and then Inserting
I have a simple insert statement that takes values from textboxes and inserts them into a sql server database.  I would like to add a value that is selected from a dropdown list and find its corresponding unique "Id" value and insert into the database as well.   My sql statement looks like this:string strSQL = "INSERT INTO aspnet_Expenses (ExpenseDate,RentalCar,ect..) VALUES (@ExpenseUserId,@ExpenseDate,@RentalCar,ect..)";I would like to add this to it:  SELECT @ExpenseUserId = UserId FROM aspnet_users WHERE Username = ExpenseUserName1) How do I assign the value from the ...

Where can I get the images used by VS2005 for "Edit, Update, Cancel"; "Select"; and "Delete"
I'm looking for small, elegant images to use in the CommandField of a GridView for Edit, Delete, and Select. Visual Studio 2005 uses images that would be perfect but I don't know where to get the files for these images so I can use them in my own project. From a GridView's Smart Tag, go to GridView Tasks | Edit Columns | Available Fields. Under CommandField there is a sub-tree with three images that are just what I need: "Edit, Update, Cancel"; "Select"; and "Delete". Does anyone know where I can find the files for these three images (.bmp, ,gif, etc.)?     I d...

"Edit" Vs"Edit Mask"
Are there any potential problems changing a datawindow date field from "edit" to "edit style" and vice versa? I have over 100 datawindows and who knows how many of them have date fields. Question is if I change the edit style from "Edit" to "Edit Mask" of dd/mmm/yyyy. Will this cause any kind of problems? TIA Well we changed ours from editmask to edit (partly because of the large numbers of bugs in edit masks in early builds of PB7, partly because our customers found editmasks unfriendly to use) and it didn't cause any problems. ...

DataControlRowState is "Edit" or "Alternate, Edit"
In the Gridview RowDataBound event, I check for the state of the row to cast some controls and manipulate with them:Protected Sub gvAutori_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then            If e.Row.RowState = DataControlRowState.Normal Or e.Row.RowState = DataControlRowState.Alternate Then             ...            ElseIf e.Row.RowStat...

wish DetailsView have "update()" & "Insert()" method
wish DetailsView have "update()" & "Insert()" method. So we can fire the "update" & "insert" from outside of the DetailsView Control. It is very useful when use two of more DetailsView controls in one page, and wish only click one button to update or Insert these DetailsView Controls at same time. I think if you don't want to go through the data source, you can use DetailsView's RaisePostBackEvent method to fire the "update" & "insert" events from the outside of the DetailsView control. DetailsView's this method is...

Web resources about - ADOQuery "Dataset not in edit or insert mode" when higher lev query inserts - embarcadero.cppbuilder.using

Resources last updated: 1/18/2016 12:40:50 AM