10 pts.
60,245 pts.

Answer Wiki:
Imports System.Data.SqlClient

Public Class Form1

Private Sub b1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles b1.Click
Dim conString As String = "Data Source=YOUR_SERVER\YOUR_INSTANCE;Initial Catalog=your_database;User ID=your_user_id;Password=your_password"
Dim conn As New SqlConnection(conString)
Dim dataAdapter As New SqlDataAdapter
Dim dataTable As New DataTable

dataAdapter.SelectCommand = New SqlCommand
dataAdapter.SelectCommand.CommandType = Data.CommandType.Text
dataAdapter.SelectCommand.CommandText = "SELECT * FROM table"
dataAdapter.SelectCommand.Connection = conn
dataAdapter.Fill(dataTable)
Me.DataGridView1.DataSource = datatable
End Sub
End Class
Last Wiki Answer Submitted:  Sep 1, 2010  4:05 PM (GMT)  by  Carlosdl   60,245 pts.
To see other answers submitted to the Answer Wiki View Answer History.
Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _