Imports System.Data.SqlClient.SqlConnectionStringBuilder
.........
Dim conn As New SqlConnectionStringBuilder()
conn.DataSource = имя сервера
conn.InitialCatalog = имя базы
conn.IntegratedSecurity = True
Using cn As New SqlConnection(conn.ConnectionString)
cn.Open()
strSQL = " SELECT * FROM TblMyTable "
Dim da1 As New SqlDataAdapter(strSQL, cn)
Dim ds1 As New DataSet()
da1.Fill(ds1, "TblMyTable ")
With ds1
Me.ComboBox1.DataSource = .Tables("TblMyTable ")
Me.ComboBox1.DisplayMember = "Name"
Me.ComboBox1.ValueMember = "Id"
End With
End Using
|