Hello sir/mam i want to help from you.i am working in asp.net c# and sql server
Suppose I have 3 columns in database and i want to insert multiple row in database on click
If i have 5 textbox mean 5 row will be insert.Please help i will wait your answer
Munesh SharmaPosted Sep 5, 2015, 2:31 AM
Monu ZiraPosted Sep 5, 2015, 2:26 AM
Pankaj Kumar ChoudharyPosted Sep 5, 2015, 1:52 AM
AS
BEGIN
DECLARE @StartIndex INT, @EndIndex INT
SET @StartIndex = 1
IF SUBSTRING(@String, LEN(@String) - 1, LEN(@String)) <>','
BEGIN
SET @String = @String + ','
END
WHILE CHARINDEX(',', @String) > 0
BEGIN
SET @EndIndex = CHARINDEX(',', @String)
INSERT INTO TabExam(Col)
SELECT SUBSTRING(@String, @StartIndex, @EndIndex - 1)
SET @String = SUBSTRING(@String, @EndIndex + 1, LEN(@String))
END
END
Munesh SharmaPosted Sep 5, 2015, 1:29 AM
Monu ZiraPosted Sep 5, 2015, 12:48 AM
Pankaj Kumar ChoudharyPosted Sep 4, 2015, 8:23 PM