Wednesday, March 7, 2012

need helps in this store procedure?

Hi Everyone,

I appreciate if you can help on the following procedure. When I ran it in my project in Visual Studio, the compiler always complained that it expected a parameter "@.stud_id" that was not provided. What was wrong with this procedure?

Thank you for your help.

a123.

ALTER Procedure registerstudent
(
@.email nvarchar(100),
@.student_password nvarchar(10),
@.first_name nvarchar(25),
@.last_name nvarchar(25),
@.address nvarchar(255),
@.city nvarchar(50),
@.province nvarchar(25),
@.country nvarchar(50),
@.phone_no_cell nvarchar(25),
@.phone_no_home nvarchar(25),
@.hour_rate int,
@.status char(1),
@.stud_id int output

)
As

INSERT INTO student
(
email,
student_password,
first_name,
last_name,
address,
city,
province,
country,
phone_no_cell,
phone_no_home,
hour_rate,
status

)
VALUES
(

@.email,
@.student_password,
@.first_name,
@.last_name,
@.address,
@.city,
@.province,
@.country,
@.phone_no_cell,
@.phone_no_home,
@.hour_rate,
@.status


)

SELECT
@.stud_id = @.@.identity

Did you add an output SqlParameter to your code?

Ryan

|||

Need to know how you execute the sp in your codeSmile BTW, usually we use SCOPE_IDENTITY() instead of @.@.identity. For the differences, you can refer to:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sa-ses_6n8p.asp

No comments:

Post a Comment