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 2008 Forums
 Transact-SQL (2008)
 Problem in storedProcedure

Author  Topic 

coolbudy
Starting Member

8 Posts

Posted - 2015-03-24 : 13:07:04
USE [asp.netlearn]
GO
/****** Object: StoredProcedure [dbo].[GetLoginDetails] Script Date: 03/24/2015 22:21:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE GetLoginDetails
-- Add the parameters for the stored procedure here

@UserName nvarchar(10),
@Password nvarchar(10)


AS

-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.


-- Insert statements for procedure here
SELECT * from Login where UserName=@UserName AND Password=@Password;


Here is my Stored Procedure when i used in my .net code its returns
error Procedure or function 'GetLoginDetails' expects parameter '@UserName', which was not supplied.

Please help me where is the problem

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2015-03-24 : 13:08:43
SELECT * from Login where @UserName=@UserName AND @Password=@Password;

Note the parameter names start with '@'
Go to Top of Page

coolbudy
Starting Member

8 Posts

Posted - 2015-03-24 : 13:12:31
Still get same error....
Go to Top of Page

ScottPletcher
Aged Yak Warrior

550 Posts

Posted - 2015-03-24 : 13:23:13
The @UserName and @Password parameters are required when you execute this proc. Change your .net code to pass both params in when you exec the proc.
Go to Top of Page

coolbudy
Starting Member

8 Posts

Posted - 2015-03-24 : 13:31:05
I already applied both parameters in my code.....
Go to Top of Page

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2015-03-24 : 13:32:22
post your .net code that sets up the parms and calls the proc
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-03-24 : 13:35:11
quote:
Originally posted by coolbudy

I already applied both parameters in my code.....



There's a bug in your .net code. You can run a trace on SQL Server to validate what you are passing, but the error is clear that you didn't send the parameter from the application.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-03-24 : 13:36:29
You can also validate it by running the stored procedure in Management Studio: EXEC dbo.GetLoginDetails @UserName='someuser', @Password='somepassword'

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

coolbudy
Starting Member

8 Posts

Posted - 2015-03-24 : 14:24:42
Yes budy you are right i have problem in my code which i re correct
Thanks........
Go to Top of Page
   

- Advertisement -