Best Way To Insert Values Multiple Times From Data Layer To Stored Procedure?

Feb 16, 2011

I have DAL Layer, from where invoking a stored procedure to insert values into the table.

E.g.:-

[code]....

Now as requirement changed, per client request i have to add values 5 times. So what is the best practice?

Do i call this Stored Procedure 5 times from my DAL?

View 4 Replies


Similar Messages:

C# - Grid Data Bound To Stored Procedure Getting Called Multiple Times?

Mar 8, 2011

I have an application that uses an aps:GridView. The GridView is populated using a DataSource that calls a Stored Procedure. The DataSource passes parameters to the Stored Procedure based on some text fields. The page has been running slower than wanted, so I was doing some checking.

I ran SQL Profiler while loading the page, and saw the Stored Procedure was being called twice. I stepped through the code and found out that in the Page Load Complete event was where this was happening. In this event, I set the value of a parameter for the Stored Procedure, then did a DataBind on the GridView to pick up the data. As I was stepping through the code, I watched the SQL Profiler. When I got to the step of setting the parameter, the Stored Procedure had not yet been called. When I stepped through that and got to the DataBind command (before running that step), the SQL Profiler showed that the Stored Procedure had been called. Then I did the DataBind and the StoredProcedure was called again.

My question is, how do I get the parameters set, and get the GridView data bound, and only call the StoredProcedure once? If I comment out the DataBind step, the StoredProcedure never does get called (which seems really strange to me...).

View 1 Replies

How To Move Stored Procedure From SQL Server 2000 To 2005, Multiple Table Insert

Jul 21, 2010

moving some tables & stored procedures from SQL Server 2000, to SQL Server 2005.So far so good, but I've come across a problem with this stored procedure:

CREATE PROCEDURE [dbo].[user_insert]
@user_service_unit int,
@user_champion_1 varchar(50),
@user_champion_1_nt varchar(10),
@user_champion_2 varchar(50),
@user_champion_2_nt varchar(10),
@user_champion_3 varchar(50),
@user_champion_3_nt varchar(10),
@user_date_received datetime,
@user_requestor varchar(255),
@user_info_requested text,
@user_expiry_date datetime,
@user_10_days datetime,
@user_5_days datetime,
@user_2_days datetime
[code]...

View 3 Replies

DataSource Controls :: Return Multiple Values From Stored Procedure?

Jun 2, 2010

Is it possible to return multiple values from a stored procedure? Basically, if I execute the stored proc on the C# side, then on the SQL side I do multiple calculations. Let's say I have 5 int values I need returned to the C# side.

View 4 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

SQL Server :: Stored Procedure In 3 Layer Architecture?

Sep 17, 2010

I am using stored procedure in my Web application. I am creating SQL Command binding this command with Stored procedure name and parameters and executing.

The problem is for each Stored procedure i need to create separate function for each stored procedure defined.

Is there any way that I can define a single function for n number of stored procedure.

View 4 Replies

ADO.NET :: Calling Stored Procedure : Server Times Out

Aug 4, 2010

So I just attempted to call a stored procedure from my VB code. Here is the code-behind function that is called to handle this:

[Code]....

And here is the Stored Procedure:

[Code]....

Then when I run this, I get an error that the server timed out. Without calling this function to reference the stored procedure, the application runs well, users can log in/create accounts, etc. But something in the function and/or the stored procedure is timing out.

View 13 Replies

Forms Data Controls :: Insert Same Record Multiple Times?

Aug 26, 2010

I have a simple form that inserts a record into a SQL table.

The fields are:

SerialNum
TagNum
PONum
Location
Address
Description

This works great. However, I have now been asked to have the form insert x number of records at one time.

They want to be able to fill out the following fields:

PONum
Location
Address
Description

and then have texbox where they can add a number and have that number of the same record inserted.

View 2 Replies

DataSource Controls :: How To Define Stored Procedure For Values Passed In Using Multiple Controls

Jun 4, 2010

I am using 3 web controls ,two are cascading dropdownlists used to filter gridview control bound to a datasource.

My question is , How to define multiple queries in stored procedure that takes parameter values from the controls declared using sqldatasource.Also, return all data when i set default control value to say 'null'.

NB: one paramaterised query for cascading dropdownlists and another for other control.

View 8 Replies

Security :: Use A Dataset Stored Procedure To Insert Data

May 29, 2010

I am trying to insert a UserID column into a database table during membership creation. I have my tables set up in a dataset with the stored procedure in there. Now I am trying to call that stored procedure in the newuserwizard code and I it is not recognizing the stored procedure. I know it is because my dataset is not referenced in the newuserwizard code. Here is the code I am using:

[Code]....

The name of the stored procedure is "InsertUserID". I think I need to create a function that references the ataset but I am not sure how to do this..

View 6 Replies

ADO.NET :: Insert And Select Data From Stored Procedure Using Linq?

Jan 18, 2011

i do have a stored procedure which inserts data and the message should be displayed that data has been sucessfully updated or not

[code]....

View 8 Replies

SQL Server :: How To Write Stored Procedure For Insert Data & Execute It In MS SQL

Oct 13, 2010

How to write Stored Procedure for Insert Data & Execute it in MS SQL?

Some websites:

[URL]

View 4 Replies

SQL Server ::trying To Use A Stored Procedure In My Codebehind Insted Of A Sqldatasource To Insert Some Data?

Nov 9, 2010

I'm trying to use a stored procedure in my codebehind insted of a sqldatasource to insert some data, and return the identity fields. But I keep getting tripped up on the output paramaters. What am I missing?

My code behind:

[Code]....

And, here's my stored procedure

Create PROCEDURE [dbo].[123]
(
@MatterToCloneID varchar(15),
@ClonedMatterID int OUTPUT,
@ClientIDOUT int OUTPUT,
@ExistingClientIDOUT int OUTPUT
)
AS
BEGIN
DECLARE
@ExistingClientID int,
@PendingClientID int,
@BillingAddress varchar(200),
@BillingCity varchar(200),
@BillingState varchar(100),
@BillingZipCode varchar(20),
@BillingCountry varchar(200)
SELECT @ExistingClientID = ExistingClientID, @PendingClientID = PendingClientID,
@BillingAddress = BillingAddress, @BillingCity = BillingCity, @BillingState = BillingState, @BillingZipCode = BillingZipCode, @BillingCountry = BillingCountry
FROM tNewMatters
WHERE MatterID = @MatterToCloneID
Set @ClientID = @EClientID
Set @PendingClientID = @PendingClientID
Set @BillingAddress = @BillingAddress
Set @BillingCity = @BillingCity
Set @BillingState = @BillingState
Set @BillingZipCode = @BillingZipCode
Set @BillingCountry = @BillingCountry
INSERT into tNewMatters
(MatterName, ClientID, PendingClientID, BillingAddress, BillingCity, BillingState, BillingZipCode, BillingCountry)
Values
('Enter Client Name', @ExistingClientID, @PendingClientID, @BillingAddress, @BillingCity, @BillingState, @BillingZipCode, @BillingCountry)
Select @ClonedMatterID = scope_identity()
Select @ClientIDOUT = @ClientID
Select @ExistingClientIDOUT = @ExistingClientID
END

View 3 Replies

Data Controls :: Insert Values Of Multiple CheckBox Values To Database

May 7, 2015

i showed two column (Electronics,Photoshop) but i have six. i want to update their checked or unchecked condition in database (0,1) how do i do?

<asp:CheckBox ID="CheckBox1" runat="server" Text="Electronics" />
<asp:CheckBox ID="CheckBox2" runat="server" Text="Photoshop" />
<asp:CheckBox ID="CheckBox3" runat="server" Text="VideoEditing" />
<asp:CheckBox ID="CheckBox4" runat="server" Text="Gaming" />
<asp:CheckBox ID="CheckBox5" runat="server" Text="Coding" />
<asp:CheckBox ID="CheckBox6" runat="server" Text="Miscellaneous" />

View 1 Replies

Forms Data Controls :: How To Replace Values In GridView Returned From A Stored Procedure

Sep 10, 2010

I am working on creating a stored procedure that will output a pivot table. In the pivot table will be either the string NULL or a number. How can I reformat this in ASP.NET so the NULL value becomes a blank cell in the gridview and the number (whatever it is) becomes an 'X' ?

View 3 Replies

C# - Is A Variable Stored In Session Deserialized Once Or Multiple Times Throughout A Page Lifecycle

Jan 27, 2010

I would like to wrap Session variables in a manner similar to that discussed on CodeProject.

[code]....

Here is my question: if I have to access CurrentUser multiple times in the same page, would I get a performance improvement by assigning it to a local variable instead of accessing the wrapping property? Or does the HttpSessionState make sure the object is only deserialized once per request, so that subsequent calls in the same http request don't cost any more?

View 4 Replies

Data Controls :: Need A Stored Procedure To Fetch Combined Data From Multiple Tables

Dec 27, 2012

i have a details table which include detailid, custname, address, classification , pincode, telephone, remarks and classification table contain classification id & classification.i want to insert detailid & corresponding classificationid to a new table detail_classification. How to write stored procedure for that?

View 1 Replies

Data Access Strategy For Single Stored Procedure Retuning Multiple Recordsets In Webpage?

Sep 18, 2010

what is the recommended data access strategy for the following environment: single stored procedure, many parameters, asp.net 4.0, sql server 2008, and the stored proc returns 11 different recordsets, all of which get displayed in various different elements too complex and specific to be handled by server controls.

View 1 Replies

ADO.NET :: Insert Into Fails With Stored Procedure?

Feb 23, 2011

i have a web form to insert into sql server 2008 db with stored procedure.

my stoed procedure is
USE [dbCustomers]
GO
SET [code]....

the code-behind; [Code]....

i'm being able to insert into my db if i fill all the fields. But if i want to leave blank the date or marital status fields, it gives the following error;

String was not recognized as a valid DateTime. String was not recognized as a valid Boolean.

View 5 Replies

INSERT Stored Procedure Does Not Work?

May 18, 2010

I'm trying to make an insertion from one database called suspension to the table called Notification in the ANimals database. My stored procedure is this:

ALTER PROCEDURE [dbo].[spCreateNotification]
-- Add the parameters for the stored procedure here
@notRecID int,

[code]...

View 5 Replies

SQL Server :: How To Create A Different Insert Stored Procedure.

Dec 14, 2010

[Code]....

I want create a stored procedure for insert values for Name,Company_Name,Designation,Eamil_Id,Remark then Ref_Id should automically get the value if insert in remain feilds like Name,Company_Name,Designation,Eamil_Id,Remark with out changing table structure

View 7 Replies

SQL Server :: Insert NULL Int Into Stored Procedure?

Jan 17, 2011

I'm strugling with this problem for quite some time and I've tried many different solution but nothing works. In my application there are 3 textboxes. First is mandatory but user can leave second and third empty. I that case I want that application insert NULL.

Here is .aspx code:

[Code]....

c# code:

[Code]....

Stored procedure:

[Code]....

I've tested code when user fills all 3 textboxes and it's working fine. If one second or third (or both) textbox(es) is(are) empty I wish to insert NULL into table. I've tried with DbNull.Value, null, 0, "3232131" and nothing works. I always get error Input string was not in a correct format. which is strange since code works when 2. and 3. tbs are filled and I'm not inserting string. And I've specified that table allows inserting of null values.

View 13 Replies

C# - Database Insert And Delete With Stored Procedure?

Jan 26, 2011

In my .aspx page, i have two textbox and one add button and one delete button.

I want simply, when entering data textboxes and click add button, adding to database with stored procedure.

When entering data textboxes and click delete button, delete from database with stored procedure.

How can I do that?

Simply I need 4 code part, add_click(), delete_click(), sp_add, sp_delete

View 1 Replies

User Default Column Value In INSERT Stored Procedure

Oct 1, 2010

From my ASP.NET application I am calling an INSERT stored procedure, there is a default value for one of the columns in the table that the INSERT procedure places the data into. How do I specify that I want the default value to be used instead? (Or do I have to specify the actual default value in my parameters)

SITUATIONAL TABLE:
Column 1: int
Column 2: string
Column 3: int default -1
SITUATIONAL STORED PROCEDURE
INSERT INTO TABLE
(Column 1, Column 2, Column 3)
VALUES
(?, ?, ?)
SITUATIONAL ASP.NET CODE
create paramter (Column 1, 12)
if (x = 0)
{create parameter (Column 2, "test")}
else
{
create parameter (Column 3, 24)
create parameter (Column 2, DBNull.Value)
}

View 4 Replies

DataSource Controls :: Insert In Stored Procedure Not Working?

May 18, 2010

i am using modalpopupextender and a listviewWhen the user click on an item in the listview it call a modalpopupextender.In that modalpopupextender there are 2 dropwn fill with datasource.When i click the ok button it call a stored procedure with 3 parameter.Nothing happen if i pass the dropdown SelectedItem.Value to the parameter but if i use a static variable the insert will work i don't know what i am missing.

View 3 Replies







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