Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Stored Procedures

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-10-28 : 08:15:07
Si writes "Hey there. Im having a bit of trouble it seems writing a stored proc.

What im trying to do is take some info (First+Last Names) from a table on my DB and insert them into corresponding textboxes on my webform.

Eg. @LastName->this.txtLastName.text
@FirstName->this.txtFirstName.text etc...

Im using a DDL which has all the names in, and when you select a teacher their names will appear in the text boxes.

Currently my stored proc returns with the error, "Stored Procedure 'GetTutorDetails' expects parameter '@LastName'"

This is my stored Proc.

create Procedure GetTutorDetails
(@PK int,
@LastName varchar(20),
@FirstName varchar(20))

As

Select LastName=@LastName, FirstName=@FirstName
From Tutors
where PKTutor=@PK

Can you see where im going wrong or not?Hope to hear soon, si"

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2005-10-28 : 08:18:46
If you are trying to return the first name and the last name, then you do not need to define them in the param list. Only if they are a parameter of the query should they be up there... if they are params, but not required, then put '= null' after each one thats not required...

My guess at what you need:

create Procedure GetTutorDetails
@PK int
As

Select LastName, FirstName
From Tutors
where PKTutor=@PK

Corey

Co-worker on children "...when I have children, I'm going to beat them. Not because their bad, but becuase I think it would be fun ..."
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-28 : 09:00:57
or

When you run your procedure you need to supply value for @LastName parameter

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -