Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Duplicate rows in dbgrid

Posted on 2000-04-16
4
Medium Priority
?
563 Views
Last Modified: 2010-04-04
Hello all ...

How does one check if a row to be
added to a dbgrid - already exists - before adding it?

I am not posting any values to the database until I press a certain button ... so all the rows are not yet saved when I want to run this check.

Thanx,
Fats
0
Comment
Question by:ffelaar
[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
  • 2
4 Comments
 
LVL 7

Expert Comment

by:Motaz
ID: 2720293
You can check it directly in your table for example:

if Table1.Locate('Name', Edit1.Text, [loCaseInsensitive]) then
 ...// that means it is already exists

Motaz
0
 

Author Comment

by:ffelaar
ID: 2720335
Wont this way always return false? There really are no records in the dataset yet ... which, by the way, is a tquery selecting from multiple tables and which has cachedupdates enabled.

Fats
0
 
LVL 4

Accepted Solution

by:
Radler earned 150 total points
ID: 2727357
procedure AddField( AField : TField );
for i:=0 to grid.Columns.Items-1 do begin
  grid.Columns.Items[i].FieldName = Afield.FieldName then begin
    //Skip add action
  end else begin
   //Add the field
  end;
end;

T++, Radler
0
 

Author Comment

by:ffelaar
ID: 2792112
I have used a variation of your comment. It put me in the right direction.

Thank you Radler
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

636 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