Dim sConnection As String = "server=local);uid=sa;pwd=password;database=yourDatabase"
Dim objDataAdapter As New SqlDataAdapter("Select * From tableName", sConnection)
Dim dsResult As New DataSet("Result")If Not IsNothing(objDataAdapter) Then
' Fill data into dataset
objDataAdapter.Fill(dsResult)
objDataAdapter.Dispose()
End If
' Test by bind data into datagridview control
Me.DataGridView1.DataSource = dsResult.Tables(0)
For Answers, see/post comments
how to use a SqlDataAdapter to get data from a database into a DataSet
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment