DataSource Controls :: Execute A Stored Procedure From An Aspx Page

Jan 8, 2010

I need to run a stored procedure from an aspx page but because it takes a long time to complete, it times out at MyDataAdapter.Fill. This sp doesn't return any recordset but the number of records affected would be nice.

Protected Sub BtnProcessDT_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnProcessDT.Click
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyDataAdapter As SqlDataAdapter
MyConnection = New Global.System.Data.SqlClient.SqlConnection
MyConnection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("RevConnectionString").ConnectionString
MyDataAdapter = New SqlDataAdapter("uspINSERTDT", MyConnection)
MyDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
MyDataAdapter.SelectCommand.Parameters.Add(New SqlParameter("@RowCount", SqlDbType.Int, 4))
MyDataAdapter.SelectCommand.Parameters("@RowCount").Direction = ParameterDirection.Output
DS = New DataSet() 'Create a new DataSet to hold the records.
MyDataAdapter.Fill(DS, "RowCount") 'Fill the DataSet with the rows returned.
Basic syntax of the stored procedure.
It SELECTS a single record (at a time) from a table, processes the data and UPDATES four other tables.
ALTER PROCEDURE [dbo_DHT].[uspINSERTDT] (@RowCount INT OUTPUT)
AS
BEGIN
select @RowCount=@@ROWCOUNT
END

Do I need to create a DataSet if all I want to do is capture the number of records? How do I increase the timeout? This is strictly an intranet web application used by one person so performance isn't a big priority. Editing the sp to reduce the amount of time to process isn't practical due to the amount of processing that occurs.

VS2005 Version 8.0.50727.42 (RTM.050727-4200)
.NET framework version 2.0.50727.3603
SQLExpress 2005 9.00.3042.00

View 2 Replies


Similar Messages:

DataSource Controls :: Execute A Stored Procedure Within A Stored Procedure?

Jan 18, 2010

Does anybody if it is possible that a stored procedure returns rows which is the result of the execution of another sp? Something like..

[Code]....

View 11 Replies

DataSource Controls :: Get Value From (insert) Stored Procedure To Aspx Page?

Mar 10, 2010

how to get value from(insert) stored procedure to aspx page?

View 2 Replies

DataSource Controls :: Execute Stored Procedure Using A String Variable

Jun 22, 2010

Is it possible to save execute stored proc command in a string variable and then execute string variable?
Does this logic fits into LINQ2SQL? Why I want to do this - INstead of passing user control references to server, I want to save user control values to string in client side java script and then pass string to server to do actual stored proc execution. Hopefully this will improve performance.

View 3 Replies

DataSource Controls :: Execute Stored Procedure From Button Click?

Jan 18, 2010

I've searched and searched for this all day, but can't seem to find the answer. I'm looking to execute a stored procedure by clicking a button. I've set this up in a code behind manner, rather than using a datasource.

The stored procedure doesn't return any rows. All I need to do is pass a variable through it. I think I have it set up correctly, however it keeps saying the stored procedure expected the @pin variable. Here's my code:

[Code]....

I've tried changing sp1 to pin and @pin, thinking that was the problem. Am I missing something?

View 9 Replies

DataSource Controls :: Execute Stored Procedure On Linked Server?

Apr 22, 2010

i need to execute stored procedure on linked server (create procedure on linked server). i had try with this:

[Code]....

SQL code is looking like this

[Code]....

UDBV68 is linked server... Now, when i execute procedure from asp.net i got error 'Incorrect syntax near 'GO'.', but sql server doesn't report error...

Dbcall has value = "EXECUTE ('Create Procedure SelectOne as Select * From FixitOnline.Os_node ',952) AT UDBV54; GO"

View 5 Replies

DataSource Controls :: How To Execute Delete Stored Procedure Programmatically (C#)

Oct 7, 2010

I need to execute a stored procedure which is a simple delete (record) query. Programmaticaly, I want to pass in a parameter "ID1".

Assume I will pass in the ID1 parameter on a delete link click event froma GridView control. What would the code be to execute the existing stored procedure?

ID1 - the parameter and primary key of the source database for the record to be deleted

GridView1 - the GridView control

spDeleteRecord - the stored procedure needing the parameter ID1 and to be executed from C# code

DeleteTableAdapter - an existing TableAdapter for the existing

Here's my start:

[code].....

View 5 Replies

DataSource Controls :: How To Pass Multiple Values And Execute Query In Stored Procedure

Jun 2, 2010

basically i have two dropdown boxes to filter data and textbox with stored procedure bound to gridview.i want to be able to query data depending on the selected value passed,either using one or more parameter values.

i would like seperate sqlcommands to chose from depending on which controls i select to pass parameters.

i have included a parameter Select(control id) as this is declared by the wizard for stored procedure.

but i am not sure how it is defined on the page and passed to procedure.

[Code]....

View 2 Replies

DataSource Controls :: EXECUTE Permission Error On SQL Server 2005 Stored Procedure When Running From The IIS?

Apr 10, 2010

sing VS 2008 at a workstation, I have successfully developed a local, file-system ASP.NET 3.5 website. The wbesite included a membership page with Windows authentication and a web parts page. The SQL Server 2005 ASPNETDB database has been created at an IIS web servr. Using the ASP.Net development server of the workstation, both the membership Membership/WebParts pages at the local website worked very well.

Then, I copied the website to a virtual directory at the IIS web server and creates a remote website for the workstation. Under theASP.NET development server of the workstation, both membership and webparts pages of the remote website at the IIS web server also worked fine.

However, when running these web pages from the IIS web server machine, something wrong happened with the web parts page. (The membership page still worked very well.) For the ASPNETDB database at the IIS web server machine, there is an EXECUTE permission error on an ASPNET stored procedure.

What are the differences between the ASP.NET development server and IIS web sever, which caused the EXECUTE permission error on the ASP.NET S.P.? How to find and fix the errors?

View 2 Replies

ADO.NET :: Execute 2 Stored Procedure In 1 Page

Feb 11, 2011

Can I execute 2 store procedures in one asp page? I copied my code here, it doesn't give me an error but the second store procedure is not executing.

using (SqlConnection connection = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]))
{
SqlCommand cmd = new SqlCommand("Sp_createOrder", connection);
cmd.CommandType = CommandType.StoredProcedure;
connection.Open();
//input parameters for the 1st stored procedure
cmd.Parameters.AddWithValue("@in_order_class", "WEB");
cmd.Parameters.AddWithValue("@in_owner_code", "OP");
cmd.Parameters.AddWithValue("@in_sales_campaign_code", "DEF");
cmd.Parameters.AddWithValue("@in_cus_key", null);
cmd.Parameters.AddWithValue("@in_lab_key", null);
cmd.Parameters.AddWithValue("@in_invoice_number", null);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
SqlDataReader rdr = null;
rdr = cmd.ExecuteReader();
int ChargeFine=0;
//this write the return value on the screen
while (rdr.Read())
{
Label5.Text="<strong>Order Key:</strong> ";
Label1.Text = rdr["ord_key"].ToString();
ChargeFine = Convert.ToInt32(rdr["ord_key"].ToString());
Label6.Text="<strong> Order Invoice Number:</strong>";
Label2.Text = rdr["ord_invoice_number"].ToString();
Label7.Text="<strong> Via Ship Via Code:</strong>";
Label3.Text = rdr["via_ship_via_code"].ToString();
Label8.Text=" <strong> Order Ship After Date:</strong>";
Label4.Text = rdr["ord_ship_after_date"].ToString();
}
//executing the second stored procedure
SqlCommand cmd2 = new SqlCommand("Sp_createitem", connection);
cmd2.CommandType = CommandType.StoredProcedure;
//input parameters
cmd2.Parameters.AddWithValue("@in_ord_key", ChargeFine);
cmd2.Parameters.AddWithValue("@in_long_item_number", "AC00107");
cmd2.Parameters.AddWithValue("@in_quantity_requested", 1);
cmd2.Parameters.AddWithValue("@in_price_override", null);
cmd2.Parameters.AddWithValue("@in_shipment_type", null);
cmd2.Parameters.AddWithValue("@in_size", null);
cmd2.Parameters.AddWithValue("@in_color", null);
cmd2.Parameters.AddWithValue("@in_subscription_issues", null);
cmd2.Parameters.AddWithValue("@in_sub_start_date", "");
cmd2.Parameters.AddWithValue("@in_sub_to_renew", "");
cmd2.Parameters.AddWithValue("@in_lab_key", "");
cmd2.Parameters.AddWithValue("@in_ship_via", "");
cmd2.Parameters.AddWithValue("@in_ship_after_date", "");
cmd2.Parameters.AddWithValue("@in_edi_sku_ID", "");
cmd2.Parameters.AddWithValue("@in_edi_style_ID", "");
cmd2.Parameters.AddWithValue("@in_edi_size_ID", "");
cmd2.Parameters.AddWithValue("@in_edi_color_ID", "");
cmd2.Parameters.AddWithValue("@in_check_item_for_duplicates", "");
connection.Close();

View 2 Replies

SQL Server :: Have A Stored Procedure Execute Another Stored Procedure During Time Period?

Jan 28, 2011

I could probably figure this out if I tried to, but I have been working so long on code, I'm a little fried

I have a stored procedure, and I want to execute another stored procedure during a time period of lets say 1/1/2011 to 12/31/2011

How Would I accomplish this?

View 4 Replies

DataSource Controls :: How To Execute 3 Stored Procedures On Page Load

Mar 30, 2010

In a pickel here. When I run this code:

[code]...

The only Stored procedure execute is the last one TSD_UpdateTimeCardEndofDay

View 3 Replies

DataSource Controls :: How To Convert The Oracle Stored Procedure To Sqlserver 2005 Stored Procedure

Apr 2, 2010

This is surareddy. i nead some small clarification in the "Stored Procedure"

how to convert the oracle Stored Procedure to sqlserver2005/2008 Stored Procedure.

right now i am enhancing the project that project already developed the oracle Stored Procedure. now our company is using sqlserver 2005/2008.

how to convert the Oracle Stored Procedure to sqlserver 2005 Stored Procedure

View 4 Replies

DataSource Controls :: Do Not Use Or Call Any Stored Procedure But It Says "Could Not Find Stored Procedure 'xxxxx'?

Dec 9, 2010

Initially, I have tried to use stored procedure. But I changed my mind and preferred to call sql query in codebase with command text. However, it stills tries to find initially-called stored procedure (which is neither called or exists).I think that it is related caching. But I tried it with different browsers it did not work.What might be the reason?

View 4 Replies

SQL Server :: Stored Procedure - EXECUTE And EXECUTE Sp_executesql

Mar 10, 2011

I am looking through a sql stored procedure which I might need to update in the near future. Basically the stored procedure is about 20 lines long. The stored procedure first builds a query

and stores it in a variable named "@Sql". And then for the last two lines of the stored procedure it appears that the big sql statement stored in "@Sql" is executed by using the "EXEC" command. See below. What is confusing though is that the query appears to be exectuted twice? Why was the query written in this way. Don't both lines do the same thing? Why is it being done twice? Could this possibly be a mistake on the
part of the person who wrote the query. Below are the two lines I am talking about?

EXEC sp_executesql @sql
EXEC (@sql)

View 4 Replies

Forms Data Controls :: Have A Gridview In Aspx Page Bound To A Stored Procedure?

Dec 7, 2010

I have a gridview in aspx page bound to a stored procedure, and data is loaded from the database. I have 2 problems which I am banging my head against. 1. Stored Proc has default values of NULL ( which is a DateTime db type) and I don't get how to give them as default values and once I have valid date time ( from textbox on form) , I need stored proc to take this value . ( I have done this from server side code but if this is able to acheive from client side that would be great.

2. As shown below my gird view is present ( no columns are bound and since the data is loading from server side ) I am unable to do sorting on the gridview without a sort expression. Does any one know how to do this?? This is my biggest concern. I have checekd all the articles I could find on google

[Code]....

View 5 Replies

DataSource Controls :: How To Call A Stored Procedure In Another Stored Procedure

May 13, 2010

i want to return output parameter from 1 storeprocedure. into another stored procedure.

View 7 Replies

SQL Server :: Pass XML From Aspx Page To Stored Procedure?

Oct 4, 2010

I would like to take your help for a small task of mine. I have dataset whose contents have been converted as xml, the contents of which needs to be sent to a stored procedure. How do i go about creating methods in the data layer and the stored procedure.What should be parameter type in the data layer's method and what should be the parameter type in the stored proc. I dont want to use a varchar at the stored proc level because it is limited to a length of only 8000 characters.

View 3 Replies

DataSource Controls :: Call One Stored Procedure In Another Procedure For Search?

May 1, 2010

I want to apply other stored procedure select query on result of first stored procedure.

View 1 Replies

DataSource Controls :: Stored Procedures Are Not Showing Up Correctly In The Stored Procedure Drop Down

Apr 27, 2010

I am using Visual Studio 2008 and SQL Server 2008 and have added a SQL datasource to my form.

When I configure the datasource, I choose my connection string which looks like this in my webconfig:

<connectionStrings>

<add
name="PSFSPRD_ConnectionString"
connectionString="Data

The database I am using has a schema called EQB and as such, my stored procedures are named as EQB.usp_SelectFunds, EQB.usp_SelectAccount, etc.

On the select tab of the Configure Data Source screen, I choose to use a stored procedure. The dropdown shows my stored procedures, however, the schema name does not show up in front of the stored procedures in the drop down. I see only usp_SelectFunds, usp_SelectAccount, etc.

I select one of the stored procedures and when I click TEST, I get the message that the stored procedure is not found. If I instead choose to use a SQL statement instead on the configuration screen and enter EXEC EQB.usp_SelectFunds and click TEST, it works fine.

Why are my stored procedures not showing up correctly in the stored procedure drop down and how can I fix this?

View 3 Replies

ADO.NET :: Trying To Execute A Stored Procedure In LINQ?

Feb 25, 2011

I am trying to execute a stored procedure in LINQ. When run in SQL Server it returns several fields, mostly integer and float fields. But when I call the stored procedure in LINQ, all it returns is 0. Here is how I am calling the stored procedure :

[Code]....

And here is the stored procedure :

[Code]....

View 3 Replies

Access :: Trying To Execute The Stored Procedure?

Jun 9, 2010

I have a stored procedure in SQL server 2000. It is a simple select query and returns a list of account names. However, when I try to execute the stored procedure, it automatically declare @return_value as int and return this int as shown below:


DECLARE @return_value int

EXEC @return_value = [dbo].[p_getAccountNameListByPrefix]
@prefixText = N'br',
@count = 40

SELECT 'Return Value' = @return_value

How can I make the stored procedure return the list of account names as expected?

View 4 Replies

SQL Server :: How To Open And Execute Stored Procedure

Aug 10, 2010

how to lock a stored procedure..

if its lock how to open and execute that stored procedure..

View 2 Replies

Execute Stored Procedure Using Sqldatasource And Get Return Value In Vb.net?

Sep 15, 2010

How can I execute a stored procedure using sqldatasource and get the return value in vb.net.

View 2 Replies

Access :: Execute Stored Procedure More Than One Time Each With A Different Value?

May 14, 2010

I am building a website that mostly uses Stored Procedures, but now I am facing a problem such that I want to execute the Stored Procedure more than one time each with a different value .

such that when I am calling it from the .vb page I could not execute it more than one time

this is my sql SP code:

ALTER PROCEDURE dbo.plnCs

View 13 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved