How to check the end of the record in Datareader?

Answer Posted / bhagwat prasad sharma

{vb.net code for selection by data reader}
//\\Start......

imports system.data.sqlclients

public class

dim con as new sqlconnection("server=bps; database=college; user id=sa; password=admin")

private button1 ()

dim str as string="select
name from student where roll_no=1"

dim cmd as new sqlcommand(str,con)

if con.state=connectionstate.closed than
con.open()

cmd.parameters.add("@roll_no",type.int)

cmd.parameters("@roll_no").value=txtroll.text

dim dr as sqldatareader

dr=cmd.executereader

if dr.read than

txtname.text=dr(1)

else

msgbox("selection error ")

end if

con.close()

end sub

end class

Is This Answer Correct ?    4 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to reduce the width of textbox in editcommandcolumn of datagrid?

532


Why do we use datasource in asp.net?

525


Is there any alternative to avoid name collisions other then Namespaces?

575


What is the Difference between MVC And MVP design pattrens

2208


How to you can limit Access to Web API to Specific HTTP Verb?

671






What is the life cycle of web page?

529


Where is the view state data stored?

578


Hi All, Im an MCA holder with 3+ years of experience in asp.net. Now i want to move to some good government job. I have no idea about different categories of exams held & which one can be applicable for my education background. I have done B.A with MCA. Please help me out with your valuable suggestions. I would be very grateful. Thanks Anuj

2846


Explain what are the advantages of asp.net mvc framework? : asp.net mvc

527


Define static constructor?

560


What are the main differences between asp and asp.net?

527


can we remote debug applications with the remote debugger installed with vs.net 2002, with vs.net 2003?

1755


List the events in page life cycle.

556


What is a web api endpoint?

537


Explain how can you debug your .net application?

541