Recent

Author Topic: SQL Select Count  (Read 2239 times)

Deepaak

  • Sr. Member
  • ****
  • Posts: 454
SQL Select Count
« on: October 22, 2017, 04:56:46 pm »
Code: Pascal  [Select][+][-]
  1. Query.sql.text:='Select COUNT(Number) From Table1';
  2. Query.ExecuteSql

Error Project Project1 raise exception.

What's Wrong.
Holiday season is online now. :-)

goodname

  • Sr. Member
  • ****
  • Posts: 297
Re: SQL Select Count
« Reply #1 on: October 22, 2017, 05:24:33 pm »
First you could try putting it is a try exception block and seeing what error is thrown. Second select statements return data and should use Query.Open; to open a data set.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: SQL Select Count
« Reply #2 on: October 22, 2017, 05:31:33 pm »
select commands must always be opened not executed.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

 

TinyPortal © 2005-2018