Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
how can i store output of sql query in variable in vb6
Posted
Comments
CRDave1988 13-Feb-12 1:25am    
Not Clear.
Bhags1992 13-Feb-12 1:28am    
i m using dis query select [Accessories] from [ACCESSORIES] where [BirthdayParty]='y'
output:-
Hall charge
Speakers
Cleaning charge
Light bill
Generator
450Chairs
Tabels
so i hav assign dis output to labels in vb6
CRDave1988 13-Feb-12 1:40am    
if u have assign than what is ur problem?
Bhags1992 13-Feb-12 1:47am    
i m using dis query select [Accessories] from [ACCESSORIES] where [BirthdayParty]='y'
output:-
Hall charge
Speakers
Cleaning charge
Light bill
Generator
450Chairs
Tabels
so how can I assign dis output to labels in vb6

1 solution

try this:

VB
dim ar as ADODB.recordset

set ar=new adodb.recordset

ar.open {SQL Statement}

do while not ar.EOF

  label.Caption=label.Caption & ar.Field(0).value

  ar.movenext
loop
 
Share this answer
 
Comments
Bhags1992 13-Feb-12 4:26am    
label.Caption=label.Caption & ar.Field(0).value but for this i want to show value of each field is into labels i.e. 1st value is in the 1st label,2nd value in the 2nd label nd so on
sarfarazbhat 3-Dec-12 8:22am    
Thanks bro your piece of code helped me in my problem. Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900