Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi! Question about Searching and display data from Oracle via VB6 form 1

Status
Not open for further replies.

b3kool

Programmer
Oct 9, 2006
3
VN
Hi everyone! I'm new to VB6 and I have a project using a VB6 form to search and display the data from Oracle9i database by press the Search button.

Firstly, I have a database, and a table named FoneDir. The FoneDir include:
Customer_ID; FoneNum; Customer_Name; Customer_Add;

I am writing a from that whenever I type the phone number and then press the Search button, the program will connect to FoneDir table and display back all the data form the FoneDir table. Would you please help me out!

Example:
_______________________________________________
| Customer Search
| Phone number: ________________ |Search|
| Customer ID: ________________
| Customer name: ________________
| Customer address: ________________
|_______________________________________________
the result should likes:
_______________________________________________
| Customer Search
| Phone number: 0906804840 |Search|
| Customer ID: 9982
| Customer name: Rivera
| Customer address: Ho Chi Minh city
|_______________________________________________

Please help me out this one! Thank you!
(Sorry for my English)

 
Hi,

There are several steps that you will need to go through to do this (I will outline the basic way, there are other ways to do this and it's really each to his own in that respect).

1) When the user clicks Search you need to build a SQL statement based on the phone number they have entered (you should also add in validation etc. but that is really an answer for a more specific question). e.g.
Code:
strSQL = "SELECT * FROM FONEDIR WHERE PHONENUMBER = '" & strPhoneNo & "'"

2) Connect to your Oracle DB and return an ADO recordset based on your SQL statement (created in step one). I seem to have made light of the hardest part of this answer, but if you look in the FAQ section (or do a search, there are lots of examples of using ADO to connect to, and return data from an Oracle DB.

3) Display data from the recordset in your controls (again, lots of answers in the FAQ's and from searches) and close connections/clear recordsets etc. which are also covered in the FAQ's.

Hope this helps, sorry it's a bit general but I thought it might be easier to find specific answers if you were aware of the steps you could go through to achieve your objective.

Cheers

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Glad I could help, thanks for the star [smile]

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top