[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 145
  • Last Modified:

datgrid binding

I have Storedprocedure named (employee_select) I want to use this storedprocedure to fill datagrid through datasource how to do that ?
0
Prof_MAM
Asked:
Prof_MAM
1 Solution
 
vinhthuy_nguyenCommented:
Hi, easy buddy,
Sub Page_load()
Dim MySqlConnection As SqlClient.SqlConnection
            MySqlConnection = New SqlClient.SqlConnection(DataPath here)

            Dim MySQLCommand As SqlCommand = New SqlCommand(employee_select, MySqlConnection)
            MySQLCommand.CommandType = CommandType.StoredProcedure

            Dim MySQLDataAdapter As SqlDataAdapter = New SqlDataAdapter(MySQLCommand)

            MySqlConnection.Open()
            Dim results As DataSet = New DataSet
            MySQLDataAdapter.Fill(results)
            MySqlConnection.Close()
            Your_data_grid.DataSource= results
            Your_data_grid.DataBind
End Sub
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now