Imports System.Data.SqlClient Public Class Form1 REM Public conn1 As SqlConnection = New SqlConnection("server=.; Integrated Security=False;Initial Catalog= mydatabase1; User ID= sa;password") Dim cn As SqlConnection Dim da As SqlDataAdapter Dim ds As DataSet Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim cnStr As String = "Data Source=(local);Initial Catalog=mydatabase1;Integrated Security=False;User ID=sa;Password=password;" cn = New SqlConnection(cnStr) da = New SqlDataAdapter("select * from mydatabase1.dbo.db_book", cn) ds = New DataSet() da.Fill(ds, "mydatabase1.dbo.db_book") DataGridView1.DataSource = ds.Tables("mydatabase1.dbo.db_book") End Sub End Class