Use Stored Procedure or insert template to insert a new record?
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?
>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.a...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
Insert ...Selecting the correct record on Gridview from inserting new record using Detailsview...
Ok...I'm determined to solve this most immediate of all problems:
I have a Gridview, I have a Detailsview: the Gridview pulls all records from a DB using an ObjectDataSource. The Details view also uses a ObjectDataSource and it pulls just one particular record based on the selected id of the Gridview. Simple straightforward...However...
Here is my Problem: After I insert a new record using the detailsview, how the heck do I have that particular record I just inserted selected on the gridview??? I've written a routine to sort through all the pages and all the records in the gridview.....Using stored procedures to insert recorders
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) ...change the mode of a DETAILSVIEW to INSERT mode as soon as a NEW RECORD is inserted in the DETAILSVIEW
Hi, In ASP.NET 2.0 with AJAX, i have a fairly long-size form. I have lots of DETAILSVIEW on screem inside UPDATEPANELS from AJAX. The postbacks occur corrrectly without updating the entire page.
Now, i want to automatically change the mode of a DETAILSVIEW to INSERT mode as soon as a NEW RECORD is inserted in the DETAILSVIEW.
How can i accomplish this ?
assuming that detailsview will return to readonly mode, you can set following in load_complete (not load)If DetailsView1.CurrentMode = DetailsViewMode.ReadOnly Then
DetailsView1.ChangeMode(DetailsViewMode.I...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
<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
Sub Register_Click(ByVal sender A...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, ...Using ADO.NET Execute Second Stored Procedure Depending of Output of First Stored Procedure
When a user logs onto the app, I capture their UserId, today's date and thier WINNT using ADO.NET calling a stored procedue-no problem.
Now, once the above mention fields have been populated, when the same user logs on again and this time click their daily attendance time, I need to execute and update stored procedure-no problem.
Each time the user logs onto the attendance page, they need to be able to view the previuos time stamps, on page load.- no problem
The problem is that I cannot get all three to work in concert, although they will work independently, somewhat. Sotred proc...How to detect return value of stored procedure used by a DetailsView Control?
I have a DetailsView control in asp.net 2.0 web site.This DetailsView inserts in a database using a stored procedure.This stored procedure has a return value that I should detect to react upon.How to detect the return value of the stored procedure that the DetailsView uses?
you can use a select statement when returning the return value and read it by using datareader.
Here is the sample you can have alook:
/*--------------------------------------------*/CREATE TABLE myItem( itemID INT PRIMARY KEY IDENTITY(1, 1), ...Detailsview updating/inserting using Stored Procedure parameter issues...
Hi all,I have an interesting situation, as usual...lol 'Modify Users' pageI have a gridview/detailsview combo with the grid feeding the detailsview a control value for it's sqldatasource 'select parameter' (userid) the SQLDATASOURCE is calling stored procedures for its actions select,insert,update,delete(delete I haven't started on yet, we'll get to that)For update, it works fine in the current form. For insert, it's telling me there's too many parameters being sent to the SP. Thing is,....ISSUE:The insert SP doesn't use as many parame...help creating a procedure that iterates thru all my stored procedures and copies them to new stored procedures with new names
I have this sql DB and I want to clone it in a way. I want to run a second web site off the same SQL database. So all my tables and stores procedures currently aare named with a 3 letter prefix that identifies the application. I need to clone all the stored procedures and give them a new name basicly changing the 3 letter prefix to another one.
Also if that procedure could once it has a stored procedure open, replace all the 3 letter prefix (of the table names) inside the stored procedure definition itself.
I know I could do all this manualy but there are over 400 stored procedures 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
INSERT INTO tbl_labels
@espl...Getting double record insertion using PD, ASA6, ODBC and stored procedures.
This is a multi-part message in MIME format.
Content-Type: text/plain; charset=us-ascii
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 ...