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

x
?
Solved

querying a database

Posted on 2003-02-25
8
Medium Priority
?
168 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
7 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
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!

 
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

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

571 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