Not able to fetch data from sql database in web application using vb

Total Post:96


 1251  View(s)
Rate this:

I am using the below code to fetch data from SQL, I am not getting any error but code is not working on button click 

Dim strSQL As String = String.Empty
strSQL = "SELECT * from jhg"
Using connection As New SqlConnection  (ConfigurationManager.ConnectionStrings("xyz").ConnectionString)
    Dim command As New SqlCommand(strSQL, connection)
    reader As SqlDataReader = command.ExecuteReader()
    While reader.Read()
        GridView1.DataSource = reader
    End While
'end connection and using close


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.