stored procedure

N

nicholas

Anyone can help me with creating a stored procedure that is only executed
when the form is submitted?

So, I have a form that should inserts values in a table. This goes with a
stored procedure. But ofcourse the value should first be filled in the
webform, and for this I have to prevent the form from executing unless the
user submits the form (and passes the form validation).

THX


Here's my SP:


CREATE PROCEDURE spaddpicture

(@picturename nvarchar, @picturedescription ntext, @picturepricecat int,
@picturepath nvarchar, @picturethumbpath nvarchar, @picturepeople bit,
@picturehigh int, @picturewidth int, @pictureweight int, @categoryID int,
@pictureID int OUTPUT)

AS

INSERT INTO tbl_pictures ([picturename], [picturedescription],
[picturepricecat], [picturepath], [picturethumbpath], [picturepeople],
[picturehigh], [picturewidth], [pictureweight])

VALUES (@picturename, @picturedescription, @picturepricecat, @picturepath,
@picturethumbpath, @picturepeople, @picturehigh, @picturewidth,
@pictureweight)

SET @pictureID = @@IDENTITY

INSERT INTO tbl_picscats (pictureID, categoryID)

VALUES (@pictureID, @categoryID)


Return
GO
 
C

Chris Jackson

Well, you just don't call the stored procedure until everything is
validated:

private void Page_Load(...) {
if (Page.IsPostBack) {
Page.Validate;
if (Page.IsValid) {
// call stored procedure
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top