VB Code:
Imports ADODB
Public Class Form1
Inherits System.Windows.Forms.Form
Private cn As New Connection()
Private rs As New Recordset()
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
'auto generated code removed in this example
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
With cn
.Provider = "SQLOLEDB"
.ConnectionString = "Data Source=SomeSQLServer;Initial Catalog=Anything"
.Open()
End With
rs.Open("Select * from tblFirst", cn)
TextBox1.Text = rs("MyField").Value
End Sub
End Class
Best regards