We have a stored proc that grabs that data from a table, let’s call it table1 from one db1 and populates a table, called table2 in db2.
We scheduled this stored proc to perform this function like every 5 minutes. This works fine.
Given that users mostly leave their apps while performing other administrative functions, we have created a refresh button that refreshes the GridView upon clicking the button.
Protected Sub Refresh_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Refresh.Click
' Clean up text to return the GridView to it's default state
strSearch.Text = ""
SearchString = ""
gridView1.DataBind()
End Sub
We would like to both click this refresh button to both to have the stored procedure update table2 and at same time, refresh the GridView.
I know that gridview1.Databind() refreshes the GridView with latest data from table2 but how do I ensure that table2 is first updated with data from table1 using the stored proc before refreshing the GridView.
Kenny I have prepared complete code in vb for you, take a look:
CallRefresh opens connection, executes “ActivateServerTask” stored procedure with “taskId” parameter and finally closes connection…
Take notice I am using connection to sql with integrated security.
You can find other connection strings here:
http://www.connectionstrings.com/
Happy coding Kenny!