Solved

dbgride question ?

Posted on 2004-04-12
8
174 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
  • 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 30 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:peruzzi
ID: 10808798
I will try it

peruzzi
0
 
LVL 17

Assisted Solution

by:mokule
mokule earned 20 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
Delphi XE2 application frozen on Windows 10 10 337
Convert a string into a TDateTime 5 63
can't find the executable in Simulator 1 100
Find and Replace Stream with 0s 8 69
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

809 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