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

x
?
Solved

dbgride question ?

Posted on 2004-04-12
8
Medium Priority
?
189 Views
Last Modified: 2010-10-05
Hi

How can I get the value of  field from the first column when I select the row

I am waiting your answers

peruzzi
0
Comment
Question by:peruzzi
[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
  • 4
  • 2
  • 2
8 Comments
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10808761
If you are using a DBGrid,

 fields[0]

 if its a string or you want it as a string, fields[0].asString


Shane

 
0
 
LVL 11

Accepted Solution

by:
shaneholmes earned 120 total points
ID: 10808780
ShowMessage(DBGrid1.DataSource.DataSet.Fields[0].asString);

Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10808790
OR if you know your table name

  MyTable.Fields[0].asString;

Shane
0
Technology Partners: 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!

 

Author Comment

by:peruzzi
ID: 10808798
I will try it

peruzzi
0
 
LVL 17

Assisted Solution

by:mokule
mokule earned 80 total points
ID: 10808909

I would always advice getting data using its name.
In most cases it is just what are interested in.

DBGrid1.DataSource.DataSet.FieldByName('Cst_firstname').asString;
0
 

Author Comment

by:peruzzi
ID: 10809181
Hi
all what you say is true
so I  wish you will be agree with my spliting points between you

thanks my friends
0
 
LVL 17

Expert Comment

by:mokule
ID: 10809306
Hi peruzzi
Never mind points. But believe me absolutely avoid getting data by column number. I'm sure Shane will tell You the same.
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10809433
I will tell you that it is recommended that you use the FieldByName method versus the fields array. Whether or not you should "absolutely  avoid" it,  could be called into question. I have used it successfuly in the past, but I try to stay away from using it, and most always use the FieldByName.

I didn't know exactly what you were trying to achieve, and your question was little hard to understand, but when I saw "first column", i thought thats what you were looking for.

Thanks Mokule!

Shane

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

610 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