Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
janetb
Yak Posting Veteran
71 Posts |
Posted - 2009-09-08 : 12:21:31
|
I created an export of a table in the SQl Server Management Studio to an excel file on the same server and it executes fine. I don't need parameters. Can anybody please provide some simple reference as to how to execute it via a .net page? (Can't do it on a set time, but a trigger is a possibility - say on add?) I do stored procs all the time but have no experience here. Sorry, I've done searches but can't seem to find this one. As you can tell, not a dba. |
|
cycledude
Starting Member
9 Posts |
Posted - 2009-09-09 : 14:13:30
|
This code lets you execute a stored proc from a subroutine stored on a code-behind page. The subroutine doesn't need to be the Page_Load routine, it can execute on the click of a button. Double-click a button on a form to get the skeleton of a click event on the code-behind page. This routine populates a Data Grid, but the called stored procedure could do anything, including calling a SSIS package.Private Sub frmTestStoredProc_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadDim cnConnection As SqlClient.SqlConnection = _ New SqlClient.SqlConnection("data source=(machine name);initial catalog=(database);integrated security=SSPI;persist security info=False;workstation id=(machine name);packet size=4096") Dim cmdGetClients As SqlClient.SqlCommand = _ New SqlClient.SqlCommand("spSelectClientName", cnConnection) cmdGetClients.CommandType = CommandType.StoredProcedure Dim myParm As SqlClient.SqlParameter = _ cmdGetClients.Parameters.Add("@ClientID", SqlDbType.Int, 4) myParm.Value = 78 cnConnection.Open() Dim dataAdapter As System.Data.SqlClient.SqlDataAdapter = New System.Data.SqlClient.SqlDataAdapter(cmdGetClients) Dim dataSet As System.Data.DataSet = New System.Data.DataSet() dataAdapter.Fill(dataSet) DataGrid1.DataSource = dataSet cnConnection.Close()End Sub |
 |
|
cycledude
Starting Member
9 Posts |
Posted - 2009-09-09 : 15:29:07
|
You may want to read this article:http://www.sqlteam.com/article/how-to-asynchronously-execute-a-dts-package-from-asp-or-aspnet |
 |
|
|
|
|