collection list in c# http://www.dotnetperls.com/list
Posts
Showing posts from January, 2013
- Get link
- X
- Other Apps
insert, update ,delete multiple rows using c# and sql at once with the help of list and function ANS. 1. Create function:- CREATE FUNCTION [dbo].[udf_CsvToInt] ( @Array VARCHAR(max) ) RETURNS @IntTable TABLE (IntValue INT) AS BEGIN IF @Array <> '' BEGIN DECLARE @separator char(1) SET @separator = ',' DECLARE @separator_position INT DECLARE @array_value VARCHAR(2000) SET @array = @array + ',' WHILE patindex('%,%' , @array) <> 0 BEGIN SELECT @separator_position = patindex('%,%' , @array) SELECT @array_value = LEFT(@array, @separator_position - 1) INSERT @IntTable Values (CAST(@array_value AS INT)) SELECT @array = stuff(@array, 1, @separator_position, '') END END RETURN end 2.update example ALTER PROC spUpdateTable @strID varchar(100) AS UPDATE tablename SET IsActive = 1 WHERE tableID in (select * from dbo.udf_CsvToInt(@strID) ) 3. C# button Click event protected void btnTagIndexPage_Click(object sender, Event...