Populate DataGridView from a Stored Procedure

前端 未结 3 741
耶瑟儿~
耶瑟儿~ 2021-01-16 12:39

Using SQL Server 2008 I created a Stored Procedure called MyStoreProc and it runs fine from the Management Tools.

In VB.Net 2008 I created a new dataset and a new Ta

3条回答
  •  青春惊慌失措
    2021-01-16 13:38

    I managed to get this going now. Below is what I did. Thank you everyone for your help. It pushed me in the right direction.

    Dim strCon As String = myConnectionString
    Dim strSQL As String = "dbo.MyStoreProc"
    Dim dataAdapter As New SqlClient.SqlDataAdapter(strSQL, strCon)
    Dim table As New DataTable
    dataAdapter.Fill(table)
    DataGridView1.DataSource = table
    

提交回复
热议问题