GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Microsoft  >  VB.NET

 Print  |  
Question:  VB.NET List Box

Answer: How can i retrieve records of a column having certain criteria and display the records in a list box? Please help me...


January 01, 2009 02:21:22 #1
 sriniinnsoft   Member Since: December 2008    Total Comments: 1 

RE: VB.NET List Box
 
dim con as sqlconnection
con=new sqlconnection("server=visuall;database=urdbname;uid=sa;password=urpassword")
con.open()
dimquerycommand as sqlcommand
dim reader as sqldatareader

querycommand=new sqlcommand("select * from emp",con)
reader=querycommand.executereader()
while(reader.reader())
listbox1.items.add(reader(0).tostring() & " " & reader(1).tostring() )
end while
     

 

Back To Question