MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.
Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click '// define a connection to the database Dim cn As New OleDbConnection(ConfigurationManager.ConnectionStrings("WhatEverNameYouWant").ConnectionString) '// define the sql statement to execute Dim cmd As New OleDbCommand("SELECT * FROM [Contacts]", cn) Try '// open the connection cn.Open() '// execute the sql statement Using reader As OleDbDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection) While reader.Read() '// this loops through all of the returned records End While End Using Catch ex As Exception Response.Write(ex.Message) Finally If cn.State <> ConnectionState.Closed Then cn.Close() End If End Try End Sub