Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim cn As New SqlConnection()
cn.ConnectionString = "user id=sa;password=password;initial catalog=northwind;"
cn.Open()
Dim cmdtext As String = "select categoryname from categories where categoryid=1"
Dim cm As New SqlCommand(cmdtext, cn)
Dim dr As SqlDataReader = cm.ExecuteReader
If dr.Read Then
TextBox1.Text = dr(0)
End If
dr.Close()
cn.Close()
End Sub