TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
fahad sheikhji
NA
53
56.6k
Better code for this ?
Mar 18 2012 1:49 AM
hi
here is my stored procedure
to increment roomno if it reaches to 32.for example in one room 32 students can sit so for that while inserting records from asp to sql that time if room no 101 reaches 32 students then while entering 101 that time it automatical increment to 102 and save records in sql table..
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[usp_InserttblRoomDisplay]
@RegNo1 varchar(50),
@Semister1 varchar(50),
@RegNo2 varchar(50),
@Semister2 varchar(50),
@RegNo3 varchar(50),
@Semister3 varchar(50),
@RegNo4 varchar(50),
@Semister4 varchar(50),
@RegNo5 varchar(50),
@Semister5 varchar(50),
@RegNo6 varchar(50),
@Semister6 varchar(50),
@RoomNo varchar(50)
AS
BEGIN
while (select count(RegNo1) from tblRoomDisplay where RoomNo=@RoomNo)>=32
while (select count(RegNo2) from tblRoomDisplay where RoomNo=@RoomNo)>=32
while (select count(RegNo3) from tblRoomDisplay where RoomNo=@RoomNo)>=32
while (select count(RegNo4) from tblRoomDisplay where RoomNo=@RoomNo)>=32
while (select count(RegNo5) from tblRoomDisplay where RoomNo=@RoomNo)>=32
while (select count(RegNo6) from tblRoomDisplay where RoomNo=@RoomNo)>=32
begin Set @RoomNo=@RoomNo + 1
end
insert into tblRoomDisplay(RegNo1,Semister1,RegNo2,Semister2,RegNo3,Semister3,RegNo4,Semister4,RegNo5,Semister5,RegNo6,Semister6,RoomNo) values(@RegNo1,@Semister1,@RegNo2,@Semister2,@RegNo3,@Semister3,@RegNo4,@Semister4,@RegNo5,@Semister5,@RegNo6,@Semister6,@RoomNo)
END
//but its not incrementing the roomno which i entered..can any one solve my problem..
can any one suggest me..thanks
Reply
Answers (
1
)
Response.Cache.SetNoStore in ASP.NET
How to display one column values in different named columns in Gridview?