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.
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 ONGOSET QUOTED_IDENTIFIER ONGO-- =============================================-- 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 hereSELECT * from Login where UserName=@UserName AND Password=@Password;Here is my Stored Procedure when i used in my .net code its returnserror 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 '@' |
|
|
coolbudy
Starting Member
8 Posts |
Posted - 2015-03-24 : 13:12:31
|
Still get same error.... |
|
|
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. |
|
|
coolbudy
Starting Member
8 Posts |
Posted - 2015-03-24 : 13:31:05
|
I already applied both parameters in my code..... |
|
|
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 |
|
|
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 KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
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 KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
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 correctThanks........ |
|
|
|
|
|