?
Solved

querying a database

Posted on 2003-02-25
8
Medium Priority
?
167 Views
Last Modified: 2010-04-04
I want to retrieve info from a Database , How do I go about it .eg see all the account numbers greater than 45100076  or how can  I send queries to SQL from Delphi .
I hope this explains it better . What I want  is to be query my database in SQL from Delphi
eg (Select  * from account where account#= '123334');
email terrychims@yahoo.com
0
Comment
Question by:Chimusoro
[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
8 Comments
 
LVL 3

Expert Comment

by:ILE
ID: 8020054
Im not shure what u meen with sending queries
what u wrote is the query


if u think how to do that in delphi
this is the answer

get one query
   one datasource
   and one dbgrid

   dbgrid datasutce property set to datasource1
   datasource dataset property set ot query1
   

and do something like this

  query1.sql.add('select * from account where account=456');
  query1.active:=true



  result of query will be in the dbgrid

(all of this if i andestand correctly what u wont)
0
 
LVL 1

Expert Comment

by:khalil_moghaddam
ID: 8036103
explain which step did you have a problem?

1- connecting to a database?
2- oppening/Showing a table?
3- defining a SQL command?
4- sending it to Database?
5- Showing result?
0
 

Author Comment

by:Chimusoro
ID: 8036698
Well I had problem with
part
3- Sending a sql command
4-sending it to Database
5- Showing its result the last 3  stages (3-5)
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 3

Accepted Solution

by:
ILE earned 100 total points
ID: 8037007
do you try what i wrote
this is all what you need
0
 
LVL 1

Assisted Solution

by:khalil_moghaddam
khalil_moghaddam earned 100 total points
ID: 8041245
I think you must connect to database first(these are steps that you must do before)
u can use ADO Or BDE Component to connect your Application to your database.

1- add ADOConnection component to your form from ADO Tab component .(Or DataBase From BDE Tab)
2- Right Click on this component and choose Connection String , On the apeared form set your database connection configuration, until "Test connection" button display successful connection.
3- Set Connected property of ADOConnection to True
4- Add ADOQuery From ADO Tab and set its connection property to ADOConnection1
5- Click on button apeared for SQL Property of ADOQuery
   Write your SQL Command on apeared form , for example
   Select  * from account where account= '123334'
   and close the form
6- Set Active property of ADOQuery to true (running query)
7- Now ADOQuery is like a table in delphi, and you can use a Dataset for connecting it to a dbgrid!

is that enough!
0
 

Expert Comment

by:CleanupPing
ID: 9317066
Chimusoro:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 10

Expert Comment

by:kacor
ID: 9969954
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:
        to split points between ILE and khalil_moghaddam
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Some days and here is the Christmas Time. I wish good luck and good health for you all and for your loved ones

kacor
EE Cleanup Volunteer
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
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 Month8 days, 18 hours left to enroll

765 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