C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

Stored Procedures


Posted Date: 07 Nov 2009      Posted By: Sonia sardana      Member Level: Gold     Points: 1   Responses: 6




Create Procedure submitrecord
(
@ID varchar(10),
@Password varchar(10),
@EMailID varchar(50),
@QueryType varchar(1)
)
if(@QueryType = 'I')
Begin
INsert into login(ID1,Password1,EMailID)values(@ID,@Password,@EMailID)
END
Else if(@QueryType = 'U')
Begin
Update login Set Password1=@Password, EMailID=@EMailID Where ID1=@ID
End


I m not able to find the in above SPRoc,Error is coming
Incorrect syntax near the keyword 'if'






Responses

Author: dom    07 Nov 2009Member Level: SilverRating: 2 out of 52 out of 5     Points: 2

Create Procedure submitrecord
@ID varchar(10),
@Password varchar(10),
@EMailID varchar(50),
@QueryType varchar(1)
as
begin

if(@QueryType = 'I')
Begin
INsert into login(ID1,Password1,EMailID)
values(@ID,@Password,@EMailID)END
Else if(@QueryType = 'U')
BeginUpdate login Set Password1=@Password,
EMailID=@EMailID Where ID1=@IDEnd
end



try the above query.......u should give 'as' ,'begin',and end at the last

rate if u satify



Author: Shivraj Singh Rajawat    07 Nov 2009Member Level: BronzeRating: 2 out of 52 out of 5     Points: 2

code is looking absolutely fine..........

Cause of error may be there is not space between ) and values. ......

try it.......



Author: Shivraj Singh Rajawat    07 Nov 2009Member Level: BronzeRating: 2 out of 52 out of 5     Points: 2

Create Procedure submitrecord
(@ID varchar(10),
@Password varchar(10),
@EMailID varchar(50),
@QueryType varchar(1)
)
begin

if(@QueryType = 'I')
Begin
INsert into login(ID1,Password1,EMailID)
values(@ID,@Password,@EMailID)END
Else if(@QueryType = 'U')
BeginUpdate login Set Password1=@Password,
EMailID=@EMailID Where ID1=@ID
End
end

now it is working fine.........



Author: Hari    07 Nov 2009Member Level: GoldRating: 4 out of 54 out of 54 out of 54 out of 5     Points: 6

Hi

use the folling there seesm tobe no space between end and begin

Create Procedure submitrecord
(
@ID varchar(10),
@Password varchar(10),
@EMailID varchar(50),
@QueryType varchar(1))
as
if(@QueryType = 'I')
Begin
INsert into login(ID1,Password1,EMailID)
values(@ID,@Password,@EMailID)
END
Else if(@QueryType = 'U')
Begin
Update login Set Password1=@Password, EMailID=@EMailID Where ID1=@ID
End



Author: Sonia sardana    07 Nov 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

hi thx to all,but hary code is working correctly out of all the anwers


Author: Bunty    09 Nov 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

Hi,

Please find the below code



Create Procedure submitrecord
@ID varchar(10),
@Password varchar(10),
@EMailID varchar(50),
@QueryType varchar(1)
AS
BEGIN
if @QueryType = 'I'
Begin
INsert into login(ID1,Password1,EMailID)values(@ID,@Password,@EMailID)
END
Else if @QueryType = 'U'
Begin
Update login Set Password1=@Password, EMailID=@EMailID Where ID1=@ID
End
END



Thanks & Regards
S.S.Bajoria



Post Reply
You must Sign In to post a response.
Next : Show Menu
Previous : Editor used in .net
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use