simple dbexpress query question.

Posted on 2003-04-01
Medium Priority
Last Modified: 2010-04-06
I'm currently teaching myself Kylix/Delphi, and am trying to do some stuff with a MySQL DB.  I am able to use the SQLQuery component to do inserts and updates so far, but something I need to do right now is get some information from a select statement.  Actually a very simple one:  "SELECT (count(id)+1) FROM messages"

creating the component with the SQL is simple, I am unsure how to retrieve the results though, I want it back as a simple string.
Question by:Blixem
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
LVL 10

Expert Comment

ID: 8248451
Could you explain your question a little bit better by an example?
LVL 12

Accepted Solution

esoftbg earned 400 total points
ID: 8249055
  I: Integer;
  S: string;
  if Query.Active then
  Query.SQL.Text := 'SELECT (count(id)+1) COUNT_ID FROM messages';
// result is:
  I := Query.FieldByName('COUNT_ID').AsInteger;
// or result is:
  S := Query.FieldByName('COUNT_ID').AsString;
LVL 27

Expert Comment

ID: 8251416
you can also use


Author Comment

ID: 8251522
Exactly what I was looking for, thanks both of ya!

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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 this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

770 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