Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

simple dbexpress query question.

Posted on 2003-04-01
4
Medium Priority
?
215 Views
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.
0
Comment
Question by:Blixem
4 Comments
 
LVL 10

Expert Comment

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

Accepted Solution

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

Expert Comment

by:kretzschmar
ID: 8251416
you can also use

Query.Fields[0].AsYouWantHere;
0
 

Author Comment

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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

578 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