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

What is the procedure to create the environment for asp.net? : asp.net mvc

698


Which property needs to be set for script manager control to extend the time before throwing time out expection if no response is received from the server?

725


What are triggers of an updatepanel?

718


i want to implement grid view value in paypal site. so how to create this code in asp.net with C#

1707


How do you implement postback with a text box?

746


How can we identify that the Page is Post Back?

721


What is the use of the tag in the web.config file?

738


How do you do Client-side validation in .Net?

812


Differences between “dataset” and “datareader”.

746


What is the recommended approach for asp.net mvc to globally intercept exceptions? What other functionality can be implemented with the approach? : Asp.Net MVC

714


Can we have a web application running without web.config file?

724


Can we have 2 web config files?

711


What are the different types of sessions in asp.net?

679


How long the items in ViewState exists?

1171


What is the use of view state?

716