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...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?
Ops, my stored procedure ...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())
________________________________________________________________...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?
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...How to transfer a GUID created using vb.net into a SQL database using a stored procedure
I am able to create a guid using:
Public Function GetGUID() As String
' Returns a new GUID
however when I try to add this to a parameter using the following:
Me.cmdSpAddOptions.Parameters("@QuoteDetailID").Value = GetGUID()
I get an error, I have also tried this:
Dim uidQuoteDetail As String = GetGUID()
Dim myuid = New System.Guid(uidQuoteDetail)
Me.cmdSpAddOptions.Parameters("@QuoteDetailID").Value = myuid
but get the error "Object must implement IConvertible"
A...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) ...sql count using stored procedure withing stored procedure
I have a stored procedure that among other things needs to get a total of hours worked. These hours are totaled by another stored procedure already. I would like to call the totaling stored procedure once for each user which required a loop sort of thing
for each user name in a temporary table (already done)
total = result from execute totaling stored procedure
Can you help with this
It would be easier if you can change the stored procedure into a function. Once you do that, the total can be calculated easily with something like thisSelect Sum(dbo.CalculateHours(User...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...How to Insert New record into sql Table using Linq?
after I did Linq to my SQL,
How Do I added New Record to my table?
Check out these videos they can explain in great detail on how LINQ to SQL works and get you going.
To give you a quick answer, if you are using the GUI then hover over the datasource and click Edit datasource. Then in the second page click advanced and click enable insert update and delete. That will allow you to perform an insert, in a round about way.Remember to mark as answer if this post answered your question.
Is this written ok?
RecordNums = db.Ph...Inserting Information into an SQL Database using Stored Procedures
I'm building an ecommerce website which requires customers to create an account before they go ahead with a purchase. I have a createaccount.aspx page in Visual Web Developer 2005 with text boxes where users can enter their details (email, password, name and address). I'm trying to insert the information which users type into the text boxes into an SQL database table called Customers.
I've dragged and dropped an SQL data source onto my page and have set it to operate on my AddCustomer stored procedure. I've confirgured my data source such that the parameter for...how to insert sql stored procedure into vb.net code??
I am trying to create a paged web site from my database file. for that i found an appropriate sql code. the only thing i don't know is how to declare this sql inside the vb. is it supposed to be in the same .aspx file or in another one?? pls help if you know. thank you so much.
here's the sql stored procedure:
CREATE PROCEDURE sp_PagedItems
-- We don't want to return the # of rows inserted
-- into our temporary table, so turn NOCOUNT ON
SET NOCOUNT ON
--Cr...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 insert the range of ip address in SQL using stored procedures
i need to insert the list of ipaddress using stored procedures.
the user will give the from and to range of IP ADDRESS.i've to insert all the possible ip address between those values.
how to do this.. With Thanks.,R.Chezhian.,=============================================Please Mark the helpful post(s) as Answered
LEts say the range is from 172.25.50.1 to 172.25.50.30 you can write a WHILE loop to loop through and insert records. There are other ways too but at this time of the night this is the best I can think of without putting any pressure on m...