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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying Oracle query output in VB 6.0

Status
Not open for further replies.

ror

Programmer
Jul 30, 2002
6
GB
Suppose I have an Oracle table TEMP having column SNO having 100 values.

Following query will retrieve seven records from the database

Select SNO from TEMP where rownum <= 7;

How can I display these values of SNO into VB 6.0 and onto what vb item ?

So I was hopping that some one has a code sample on how to do this ???

Thanks in advance.

Regards,
Ror
 
If you just want to look at the values you can use :

1. A text box with Multiline set to true.
Dim a as String
'open your recordset here
With rst
Do While not .eof
a = a & rst!textfield & vbCrLf
Loop
txtTextbox.text = a

2. A Listbox
Dim a as Listitem
'open your recordset here
With rst
Do While not .eof
Set a = ListView1.ListItems.Add(, , rst!textfield, , 0)
Loop
Let me know if this helps

Check out FAQ222-2244
 
What are you using to connect VB to Oracle? OO4O? ADO? RDO?

You must create a string and store your SQL statement in it. Then you'll have to use a connection object to instantiate the database so you can create a dynaset based on your query.

Does this help?
 
Hi,

Thanks for the response.
Just wanted to know how to display it in Flexgrid.

Suppose a query is there,

Select name,telephone_no from local_installers where rownum <=7

How will I display name, telephone_no into a flexgrid control having first four records????

And if MORE button is pressed then it should display the rest three.

Thanks for the help in advance !!!

Regards,
Ror


 
If your query returns a recordset myRST, and if the Flexgrid is not bound to the data then this should work
Code:
Dim a as Integer
myRst.Movefirst
for a = 1 to 3
MSFlexgrid1.Additem(name & vbTab & phone_number)
myRst.MoveNext
Next a
In your 'Next' button click event
Code:
Dim a as Integer
Dim b as Integer
b = MSFlexgrid1.rows
for a = 1 to b
MSFlexgrid1.removeitem
next a
for a = 1 to 3
MSFlexgrid1.Additem(name & vbTab & phone_number)
myRst.MoveNext
Next a

This should get you started (code not checked due to lack of time) Let me know if this helps

Check out FAQ222-2244
'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top