Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


VERY SLOW INSERTS USING SqlCommand.ExecuteNonQuery()


VERY SLOW INSERTS USING SqlCommand.ExecuteNonQuery()

Author
Message
puneetshadija
puneetshadija
Supreme Being
Supreme Being (277 reputation)Supreme Being (277 reputation)Supreme Being (277 reputation)Supreme Being (277 reputation)Supreme Being (277 reputation)Supreme Being (277 reputation)Supreme Being (277 reputation)Supreme Being (277 reputation)Supreme Being (277 reputation)

Group: Forum Members
Posts: 1, Visits: 2
Hi All,



When I am trying to make loads of Inserts into my database ... it takes lots of time to insert using SqlCommand.ExecuteNonQuery(). Even though I have created an SP as following:



ALTER PROCEDURE myProc

(

@param1 varchar(50),

@param2 int,

@param3 decimal(18,0),

@param4 decimal(18,0)

)

AS BEGIN

BEGIN TRAN

DECLARE @result int;

exec @result = sp_getapplock = 'Lock_Id', @LockMode = 'Exclusive';

IF @result = -3

BEGIN

ROLLBACK TRANSACTION

END

ELSE

BEGIN

INSERT INTO myTable values(@param1, @param2, @param3, @param4)

exec @result = sp_releaseapplock @Resources = 'LockId'

COMMIT TRANSACTION

END

END

END






I am not sure, if the problem is with the above SP or any other reason coz of which, it takes such a long time to insert.



Plz suggest !!!



Thanks
GO



Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search