Use Stored Procedure or insert template to insert a new record?

Hi there,

I am using stored procedure for all my database website before I use .net 2. When I come to .net 2, I found almost all the videoes are using SP for select functions, and using insert template to add new ones. What's the differenence and which way is better?

Thanks!

0
SunshineCoast
5/29/2007 5:42:20 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

2 Replies
1041 Views

Similar Articles

[PageSpeed] 14
Get it on Google Play
Get it on Apple App Store

 >which way is better?
Whenever you can, use stored procedures - preferably your own, not some of the autogenerated horrors! If you want some help in generating them - see my post in  http://forums.asp.net/p/1091006/1635955.aspx#1635955 plus the helper bits in http://forums.asp.net/p/1089533/1631113.aspx#1631113.

You should consider separating all the data access into a separate class library project. That way it can be readily tested by NUnit.

 


Don't forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
0
TATWORTH
5/29/2007 6:39:42 PM

Thanks a lot!

In fact I prefer to use my own SPs.

0
SunshineCoast
5/29/2007 8:51:14 PM
Reply:

Similar Artilces:

Using a stored Procedure to insert a new record
ok I have a stored procedure...... I pass in the variables that are requried....What is the best way to add a record using my stored procedure in VB.net code in a button click event...... How might i do this with a data reader,,data adapter.....OR What.......................Do I need to declare all my varaibles I am adding to this new record in the line after POSCODE or can vb.net do this without a parameter statemetn CREATE procedure dbo.Appt_AddAppt ( @ClinicID int, @AccountNum nvarchar(10), @DOS nvarchar(12), @POSCODE nvarchar(5) ) as Insert ...

Inserting a new record from DetailsView using a stored procedure
I am using an <asp:DetailsView ...> on my <asp:Content ...> page.I have the AutoGenerateInsertButton="True".The DataSourceID for the DetailsView is a SQLDataSource.My Insert command uses a stored procedure that takes the fields a input parameters:   InsertCommand="AddMovie" InsertCommandType="StoredProcedure"I am using a stored procedure to do add a record to my table.My question is: After I click on the "New" button and add data to the DetailsView, how do the values entered get to my stored procedure? What am I missing here? ChuckChuck Ops, my stored procedure ...

Problem with changing Insert to use stored procedure (insert event fired but Insert not exec)
Hi all, I'm got the club and didn't like that it required full rad and write access the clubsite db.  First thing I did was change the DB to match standards that I'm use to and create stored procedures for everything.   So now that I've done that I can't get my code to work with the insert.  I know the insert event is fired because if I change the name of the page in the insert event code is goes to that page.  I also know that the insert stored procedure is not being run because sql profiler is not showing it (only the select from the following page).  Below is t...

Populating INSERT template from a record using formview for an INSERT
Can anyone tell me how to pre-populate the insertitemtemplate of a formview with a previous record for inserting into a db. As in edit mode, but I am inserting new records into a database based on the details of a previous record. All the controls for inputting need to populated by the previous record in the db. How do I achieve this as the formview in insert mode clears all the controls. I can view the details in edit mode, but I obviously cant insert the record then. Any help>?? What you're after isn't built-in like the add and edit (it's a kind of pre-populated add) - but ...

Using stored procedures to insert recorders
Hi I am not familiar with stored procedures, but I tried to use it with this code and it worked fine   ALTER PROCEDURE dbo.p_insert_shortleave      @Leave_Date datetime,      @Start_time datetime,      @End_time datetime,      @Reason varchar(150),      @Submission_date datetime,      @L_D_id_Priority varchar(20)AS      INSERT INTO HR_Leave_request (Leave_Date, Start_time, End_time, Reason)   ...

how to excute stored procedure that insert record and return last inserted value
Dear all, I am using C# , asp.net and sql server 2005. Let me explain the situation. I have written procedure to insert data into the table and return last inserted value by @@identity variable. Now my question is how do I execute this process so that I can Get last inserted variable values       Please help  thanks    I'm not sure I'm following completely.  If you are inserting data into SQL via this stored procedure, I'm assuming the data to be inserted is passed to the SP as SQL parameters.  Are you saying you want...

Error when attempting to insert record using stored procedure
I am trying to save user data to a sql table but keep getting the following error; Unable to cast object of type 'System.Boolean' to type 'System.Data.SqlClient.SqlParameter'. I am using VWD Express Edition with .NET 2.0 and a SQL 2000 database. The code that generates the error is as follows; Public Function chkUser(ByVal strUser As String) As Stringdim MyConnection As SqlConnectionDim MyCommand As SqlCommandDim ReturnString As StringDim params As SqlParameterDim SelectCmd As String = "wm_CheckUser"MyConnection = New SqlConnection(myConnectionString)MyCommand = New SqlCommand(SelectCmd, ...

Problem with inserting a Record using textbox and stored procedure
Below is the code for a form with several textboxes that I would like to use the values from to insert a record using a stored procedure. I am not having any sucess. After entering all the values and clicking the submit button no record gets entered. Any help would be greatly appreciated. Thanks in advance Gary <%@ Page Language="VB" Debug="true" %> <%@ import Namespace="System.Data" %> <%@ import Namespace="System.Data.SqlClient" %> <script runat="server"> Sub Register_Click(ByVal sender A...

Inserting new record into normalized db
Hi,I'm writing an employee contact details application where each employee will have one or many contact addresses, emails and phone numbers. The database is normalized such that the main employee record holds simply an employee id, first name(s) and last name. I then have separate address, email and phone number tables with the employee id in these tables being a foreign key to the main employee record. The application will need to be flexible with respect to how many addresses/email/phone numbers the user enters for a particular employee. My question relates to the best approach as far...

Please help want to use the stored procedure to insert record to table
Please help, first time trying to use the stored procedure. Can you please modify my code below which is in asp.net to insert the record's in table(tbl_labels) using my stored procedure, i don't have problem inserting records, but i want to use my stored procedure to insert the record. Please help I never used a stored procedure. ********** CREATE PROCEDURE sp_insert_label ( @engl nvarchar, @espl nvarchar, @frlbl nvarchar, @gerlbl nvarchar ) AS INSERT INTO tbl_labels ( eng_lbl, esp_lbl, fr_lbl, ger_lbl ) VALUES ( @engl, @espl...

View Inserted Record Using Object Datasource, Details View and Stored Procedure
I am trying to display the record just inserted into a database using an object datasource, a stored procedure and a details view Below is the stored procedureALTER PROCEDURE [dbo].[Employees_Insert]( @LastName varchar(50), @FirstName varchar(30) = null, @JobTitle varchar(50))AS SET NOCOUNT OFF;INSERT INTO [dbo].[Employees] ([LastName], [FirstName], [JobTitle])VALUES (@LastName, @FirstName, @JobTitle);  SELECT  LastName, FirstName, JobTitleFROM Employees WHERE (EmployeeID = SCOPE_IDENTITY()) ________________________________________________________________...

Debug stored procedure that uses comma delimited list to insert multiple records
I need some help with a stored procedure to insert multiple rows into a join table from a checkboxlist on a form. The database structure has 3 tables - Products, Files, and ProductFiles(join). From a asp.net formview users are able to upload files to the server. The formview has a products checkboxlist where the user selects all products a file they are uploading applies too. I parse the selected values of the checkboxlist into a comma delimited list that is then passed with other parameters to the stored proc. If only one value is selected in the checkboxlist then the spproc executed correc...

Getting double record insertion using PD, ASA6, ODBC and stored procedures.
This is a multi-part message in MIME format. --------------7225442257FA38DBB2196E0F Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, I am calling a stored procedure from a PD app which always yields a double record insertion into the db, when it should only insert one row. The same stored procedure works fine from "Interactive SQL". This stored procedure simple inserts a row using an auto incremented column and also inserts a time stamp as well. It was suggested that this may be an ODBC issue however I did not find any evidence to support ...

Insert multiple records using one stored procedure call. SQL SERVER 7
Hi I have asp.net page with approx 28 dropdowns. I need to insert these records using one stored procedure call. How can I do this while not sacrificing performance?   Thanks, GaryGary Gary, I'm not clear on exactly what you're asking. 28 dropdowns equates to 28 parameters in your stored procedure if you're just inserting a record. Can you provide more details? BruceBrucePlease remember to click "Mark as Answer" on the posts that helped solve your issue. Ok Chuck, never mind about the dropdowns. All Im ask is how to insert multiple records into a database u...

Web resources about - Use Stored Procedure or insert template to insert a new record? - asp.net.presentation-controls

Parliamentary procedure - Wikipedia, the free encyclopedia
... of the House of Commons of the Parliament of the United Kingdom , from which it derives its name. In the United States, parliamentary procedure ...

Procedure is more a snap than a snip
A QUEENSLAND doctor is bidding to set an unusual world record by performing the highest number of vasectomies in one day, with the help of fellow ...

Rushed cosmetic procedures a 'recipe for disaster'
&#8203;When Chanelle O'Hare went searching online for a deal on potential cosmetic procedures, she could not have imagined that what she ended ...

Jetstar procedures under investigation after planes took off too heavy
Jetstar's procedures for calculating the weight of its aircraft are under review by the Australian Transport Safety Bureau after two of its planes ...

Old Lady Lawyer: Uncivil Procedure
What is some of the worst behavior you've witnesses by attorneys?

NFL Announces Changes to Officiating Procedures for Playoffs - Bleacher Report
The NFL formally approved changes to its postseason officiating procedures to allow referees the opportunity to consult Vice President of Officiating ...

We need to reform the culture of law enforcement, not just the procedures
We need to reform the culture of law enforcement, not just the procedures by digby I have a new piece up at Salon this morning about police ...

Will Paul Ryan Make His Mark As Speaker By Instituting Impeachment Procedures Against President Obama ...
Wisconsin Ayn Rand devotee Paul Ryan just started his new job as Speaker of the dysfunctional House Republicans. And he's already headed for ...

TSA Updates Screening Procedure, Will Mandate Some Passengers Use Full-Body Scanners
... Imaging Technologies, or AIT, in favor of full-body pat-downs by TSA agents. Under the new mandate, not everyone can opt for the pat-down procedure. ...

'Painless' dental cavity procedure regrows tooth enamel
... "cavity" a lot of people sweat thinking about painful injections and relentless drilling. But scientists in Britain have developed a new procedure ...

Resources last updated: 1/10/2016 3:23:50 AM