Populate DataGridView from a Stored Procedure

前端 未结 3 704
耶瑟儿~
耶瑟儿~ 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:19

    try DataGridView2.DataBind(); at the end

    0 讨论(0)
  • 2021-01-16 13:29

    There seem to be a wealth of resources available on how to do this. The best source would be: http://www.asp.net/learn/data-access/ -

    Failing that a good old fashioned search yields lots too.

    0 讨论(0)
  • 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
    
    0 讨论(0)
提交回复
热议问题