Problem - how to avoid adding records to a DBGrid?

delphi

    Sponsored Links

    Next

  • 1. IBDataSet (Column and row update)
    Hi, I have few fieds in a table (data type - char(1)) which only accept "Y" or "N". I display this field values on a DBCtrlGrid with DBCheckBoxes. Visually looks like this. In Stock Returned etc. <Stock Button> <Return Button> Item1 X X Item2 X X Item3 X X Item4 X X I have two functions. One is to update one column . For example, when the user click <Stock Button> it will set stock value to "Y" and other columns to "N". Other function is just update one row (record). For example, when the user tick one checkbox in a row set that value to "Y" and all other values in that row (record) to "N". I am using IBDataSet. I get "not in edit mode" error. Here is my code. For column update if not DM.IBTransaction.InTransaction then DM.IBTransaction.StartTransaction; DM.IBDataSet1.First; While not DM.IBDataSet1.Eof do begin DM.IBDataSet1.Edit; DM.IBDataSet1INSTOCK.Value := 'Y'; DM.IBDataSet1RETURNED.Value := 'N'; DM.IBDataSet1.Post; DM.IBDataSet1.Next; end; For row (record) update if not DM.IBTransaction.InTransaction then DM.IBTransaction.StartTransaction; DM.IBDataSet1.Edit; DM.IBDataSet1INSTOCK.Value := 'Y'; DM.IBDataSet1RETURNED.Value := 'N'; DM.IBDataSet1.Post; What am I doing wrong here? Thanks. Alan
  • 2. IBX and ISAPI
    Is there any known problems with having IBX holding a permanent connection to an Interbase database via a webdatamodule? I have a webdatamodule that I plan to cache, and there for hold a permanent connection to the database. Are there any problems with this approach? Thanks for any info Alan
  • 3. TIBClientDataset refresh problem
    I have a couple of applications using a TIBDatabase, TIBTransaction, and some TIBQuery, TDataSetProvider, and TClientDataSet components. The applications function fine when used alone. However, there are some problems when I run the applications together on the same workstation. I am using one of the applications as a communication module to update the database. I close and open the TClientDataset, Post the data, and then call ApplyUpdates. This works fine, and I can see the updated data using IBConsole. However, if I am running the other application simultaneously, it cannot see the updated data, even after I close the TClientDataSet and reopen it. I thought that doing that would cause the ClientDataSet to refetch the data from the server, but apparently that is not the case. What am I doing wrong? What needs to be done to get the second application to see the updated data? Thanks for your help!
  • 4. Better trasaction properties
    Hi, Is correct the next params to a transaction which only read data? isc_tpb_read_committed isc_tpb_rec_version isc_tpb_nowait isc_tpb_read ...or i have use: read consistency In a DataSnap server worth have a transaction to update and other to read only? Thank in advance.

Problem - how to avoid adding records to a DBGrid?

Postby Paul Linehan » Mon, 07 Jul 2003 02:36:12 GMT


Hi all,


Small problemo... 

I have a DBGrid -> DataSource - IBQuery/IBUpdateSQL and I want users to 
be able to *_change_* a certain number of configuration parameters 
stored in a database.


This is fine and works a treat - *_BUT_* what I don't want them to be 
able to do is add new records to the DBGrid, but when I do DownArrow at 
the bottom, it gives an error message "Cannot insert into database (No 
Insert Query)" - and this is because I deleted the insert SQL generated 
by the IBUpdateSQL because I didn't want any inserts.

Also, when I do Cntrl-Del, it asks me if I want to cancel - I just want 
the app to do nothing if I try and delete also.


How do I allow people to edit the values already in the DBGrid but not 
let them add (or delete) any records.


TIA.

Paul...


-- 

plinehan__AT__yahoo__DOT__com

C++ Builder 5 SP1, Interbase 6.0.1.6 IBX 5.04

Re: Problem - how to avoid adding records to a DBGrid?

Postby Paul Linehan » Mon, 07 Jul 2003 04:43:39 GMT


 XXXX@XXXXX.COM  says...

 


Thanks Bill.


Paul...


-- 

plinehan__AT__yahoo__DOT__com

C++ Builder 5 SP1, Interbase 6.0.1.6 IBX 5.04

Re: Problem - how to avoid adding records to a DBGrid?

Postby Paul Linehan » Wed, 09 Jul 2003 21:19:16 GMT

 XXXX@XXXXX.COM  says...




Sorry - forgot to mention - using C++ 5 aser sig.

What is eqivalent command in C++?


Paul...



-- 

plinehan__AT__yahoo__DOT__com

C++ Builder 5 SP1, Interbase 6.0.1.6 IBX 5.04

Re: Problem - how to avoid adding records to a DBGrid?

Postby Paul Linehan » Thu, 10 Jul 2003 02:43:12 GMT

 XXXX@XXXXX.COM  says...




I did actually look up the help before posting and couldn't c SysUtils - 
what do I need to include in the header?

I tried a basic app - 1 form, 1 button

void __fastcall TForm1::Button1Click(TObject *Sender)
{

  SysUtils::Abort();

}

get compiler message 

[C++ Error] Unit1.cpp(21): E2090 Qualifier 'SysUtils' is not a class or 
namespace name
[C++ Error] Unit1.cpp(21): E2379 Statement missing ;


tried saving and building app - same ting,


Paul...
 

-- 

plinehan__AT__yahoo__DOT__com

C++ Builder 5 SP1, Interbase 6.0.1.6 IBX 5.04

p.s. just lacerated a tendon in left hand, so pls 
excuse typos and tricky abbrevs - TIA.

Similar Threads:

1.How to display a dbgrid only for adding new records

I'm using firebird and interbase express and bcb6
I want to use a dbgrid only for adding new records
I don't want to display old ones when the form is displayed.
Any ideas;;


2.Unwanted Sorting in DbGrid - after record add

I am new here so pardon me if this issue arised before. 
Scenario: using dbgrid to amend the table content. over multi-tier environment. using clientdataset.

Problem: after adding a record in the dbGrid, data is automatically sorted (believe on sorted by the first field in the grid). 

Question: how do I stop the sorting and wish to control myself on the display after record add. 

Appreciate any input. Cheers


3.Record ordering [Was: Problems wilth filtering records and/or GotoNearest]

Using Delphi 2006, MySQL 5 and Corelab DBExpress drivers.

I have been experimenting with my sorting order problem this weekend. The
only way I can get a correct order is to use TSQLQuery together with a
TDataSetProvider, with option RetainServerOrder, and a ClientDataSet.

But as soon as Delphi tries to interfere with the data (one way or the
other), things get messed up.

For example: I need to use GotoNearest. This means I need to set an index on
my ClientDataSet.

As soon as I add an index, as a result Delphi orders on the clientside (is
this assumption correct ?) and this ordering messes up the sortorder.

Right sort order:

B-9999
B-99999
B89999
B99999

Sort order when specifying index:

B89999
B-9999
B99999
B-99999

It looks like the "-" is being ignored. Because that would lead to:

B89999
B9999
B99999
B99999

And that is once again correct.

So what could cause Delphi to ignore (?) the "-" sign ?


4.Problem: master records + repeating detail records using Rave?

I have a tricky problem, but perhaps somebody can point me to a simple
solution.

I have two tables. The first contains a variable number of records,
and the other contains just three. All are created at runtime.

I need to print the first record held in Table A, followed by the 3
records from Table B, then the second record from Table A, and again
the 3 records from Table B, then the third record in Table A, and
again the 3 records in Table B -- until all Table A records have been,
as below:

------------------------------------------
J Brown, Dingle & Partners  20500.00 28 30
------------------------------------------
C Dellow, Frenchay & Sons   21200.50 29 32
A Brown, Allman Brothers    23030.29 41 18
G Arthurs, Powell Company   48010.00 22 13

------------------------------------------
R Bull, Sanglier et fils    21500.20 26 10
------------------------------------------
C Dellow, Frenchay & Sons   21200.50 29 32
A Brown, Allman Brothers    23030.29 41 18
G Arthurs, Powell Company   48010.00 22 13

------------------------------------------
T Woods, Research Group     19250.90 02 09
------------------------------------------
C Dellow, Frenchay & Sons   21200.50 29 32
A Brown, Allman Brothers    23030.29 41 18
G Arthurs, Powell Company   48010.00 22 13

etc.

The above is a trivial programming problem. What makes it tricky is to
accomplish it using Rave Reports. This is part of a larger project for
users who are familiar with the Rave interface.

Thanks in advance.

Bob Yorke

5.dbGrid, with multi-record drag and drop

I am looking for a dbGrid which supports multiple row selection, and
then the ability to drag and drop all selected rows. 

6. Open second form to edit DBGrid record

7. Delphi 2: DBGrid showing records limited to its size

8. display the record number on dbgrid



Return to delphi

 

Who is online

Users browsing this forum: No registered users and 85 guest