Showing posts with label passing. Show all posts
Showing posts with label passing. Show all posts

Wednesday, March 28, 2012

Running a Stored Procedure without passing parameters

HI all,

I'd like to run a simple stored procedure on the Event of a button click, for which I don't need to pass any parameters, I am aware how to run a Stored Procedure with parameters, but I don't know how without, any help would be appreciated please.

thanks.


The code would be similar to what you have if you had parameters. Just chop off the part of the code where you add the parameter.|||

thanks for that, however I can't use the normal way I used with parameters :

SQLDataSource1.InsertParameters("Till_Name").DefaultValue = tillname

As for the above I've used the InsertParameters method of my SQLDataSource1 object, which requires a parameter, although all I want to do is trigger a Stored Procedure. Do you follow?

|||

Have a look at the link

http://msdn2.microsoft.com/en-us/library/w1kdt8w2.aspx

Quoting the relevant portion from the link

"

If the database you are working with supports stored procedures, you can set theSelectCommand property to the name of the stored procedure and theSelectCommandType propertyStoredProcedure to indicate that theSelectCommand property refers to a stored procedure. The following example demonstrates a simple stored procedure that you can create in SQL Server:

CREATE PROCEDURE sp_GetAllEmployees AS
SELECT * FROM Employees;
GO

To configure theSqlDataSource to use this stored procedure, set theSelectCommand text to "sp_GetAllEmployees" and theSelectCommandType property toStoredProcedure.

Most stored procedures use parameters. For more information about using stored procedures with parameters, seeUsing Parameters with the SqlDataSource Control.

At run time,SqlDataSource control submits the text in theSelectCommand property to the database, and the database returns the result of the query or stored procedure to theSqlDataSource control. Any Web controls that are bound to the data source control display the result set on your ASP.NET page.

"

|||

thanks for that ambarsihg, I have my stored procedure as a SelectCommand, however my problem is the syntax of running the SelectCommand from a button press for example.

e.g.

SqlDataSource2.SelectCommandType = SqlDataSourceCommandType.StoredProcedureSqlDataSource2.SelectCommand()
This doesnt work, so how do I do it please?|||Dim myConnectionAsNew SqlConnection([your connection])
Dim myCommandAsNew SqlCommand("[your stored procedure]", myConnection)
myCommand.CommandType = CommandType.StoredProcedure
myCommand.ExecuteNonQuery()

ExecuteNonQuery executes the Stored Procedure

|||Thanks very much, much head scratching avoided!Smile

Saturday, February 25, 2012

RUN "Intergration Services Deployment Manifest" through Command Prompt

Hi, I want to run "Intergration Services Deployment Manifest" through the command prompt, passing the values .. which should basically go and install that Package either on File System or SQL Server. Does any one have any idea on how to do that ...

Thanks,

You can use the dtutil command prompt utility to copy a package to the Microsoft SQL Server database, the SSIS Package Store, or the file system.

However, the package must already exist in one of these three locations.

For more information, see "dtutil Utility" at http://msdn2.microsoft.com/en-us/library/ms162820.aspx.

|||Thanks alot for your reply ..

RUN "Intergration Services Deployment Manifest" through Command Prompt

Hi, I want to run "Intergration Services Deployment Manifest" through the command prompt, passing the values .. which should basically go and install that Package either on File System or SQL Server. Does any one have any idea on how to do that ...

Thanks,

You can use the dtutil command prompt utility to copy a package to the Microsoft SQL Server database, the SSIS Package Store, or the file system.

However, the package must already exist in one of these three locations.

For more information, see "dtutil Utility" at http://msdn2.microsoft.com/en-us/library/ms162820.aspx.

|||Thanks alot for your reply ..