Sharad Gupta

Sharad Gupta

  • 98
  • 19.7k
  • 8.6m

registration form using stored procedure in asp.net

Feb 8 2014 2:34 AM
I want to create a
registration form using "stored procedure" in asp.net with " table valued paramter"
and that sp also checks a username exists or not
and code is

USE [news]
GO
CREATE TYPE [dbo].[SampleDataType2] As Table
(
                                    Fname_Name varchar(50),
Lname_Name varchar(50),
USER_NAME nvarchar(50),
User_email varchar(50),
User_mobile varchar(50),
User_Permanent_Address varchar(50),
User_Contact_Address varchar(50),
User_DOB varchar(50),
User_image varchar(50)
)


/****** Object:  StoredProcedure [dbo].[Regitsration]    Script Date: 02/09/2014 01:05:34 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create PROCEDURE [dbo].[Regitsration1]
@Sample As [dbo].[SampleDataType2] Readonly,
@Username nvarchar(50),
@Result varchar(50) OUTPUT
As
Begin
IF EXISTS(SELECT User_Name FROM Registration_master WHERE User_Name = @Username)
Begin
Set @Result = 'Already Exist'
Return;
End
Else
Begin
Insert into Registration_master (Fname_Name,
Lname_Name,
USER_NAME,
User_email,
User_mobile,
User_Permanent_Address,
User_Contact_Address,
User_mobile,
User_image)

Set @Result = 'Done'
Return;
End
End



and problem is:  Procedure Regitsration1, Line 24
Incorrect syntax near the keyword 'Set'.
thanks.. 


Answers (6)