Here is my attached code. Thanks
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim strConn As String
Dim sSql As String = "select * from products"
strConn = "Initial Catalog = NORTHWIND; data source = SERVER;uid=;pwd=;Trusted_Connection=Yes"
Dim cn As New SqlConnection
cn.ConnectionString = strConn
Dim adapter As New SqlDataAdapter(sSql, cn)
Dim dSet As New DataSet
adapter.Fill(dSet)
Dim table As DataTable = dSet.Tables(0)
DataGrid1.DataSource = table
End Sub
|