DataReader code block


/ Published in: VB.NET
Save to your folder(s)



Copy this code and paste it in your HTML
  1. Using myConnection As New SqlConnection
  2. myConnection.ConnectionString = ConfigurationManager.ConnectionStrings("strConn").ConnectionString
  3.  
  4. Dim myCommand As New SqlCommand
  5. myCommand.Connection = myConnection
  6. myCommand.CommandText = "spSelect"
  7. myCommand.CommandType = CommandType.StoredProcedure
  8. myCommand.Parameters.AddWithValue("@User", ViewState("User").toString())
  9.  
  10. myConnection.Open()
  11. Using dtrReader As SqlDataReader = myCommand.ExecuteReader()
  12. While dtrReader.Read()
  13.  
  14. strLink = dtrReader("Title")
  15.  
  16. End While
  17. End Using
  18. myConnection.Close()
  19.  
  20. End Using

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.