|
Hi all,
i'm doing this insert (see attached code) after the
insert I do a immediate re-direct to the inserted "Thread" however 2/10
the thread has not arrived in the db yet! I have to refresh the page several
times and it somethimes takes more than 25 seconds for it to show
up!
I have honestly never experienced anything like
this with SQL Server, it's always pretty darn fast...
Am I missing something simple?
Anyone??
CREATE PROCEDURE spForumThreadInsert
( @categoryID INTEGER, @header VARCHAR(200), @threadBody VARCHAR(8000), @someoneID INTEGER, @startDate SMALLDATETIME = NULL, @expiryDate SMALLDATETIME = NULL, @newThreadID INTEGER = NULL OUTPUT ) AS DECLARE @bError BIT
SET @bError = 0 BEGIN TRANSACTION
DECLARE @bApprovalRequired BIT, @bApproved
BIT
SET @bApprovalRequired = (SELECT
approvalRequired FROM tblForumCategory WHERE (pkCategoryID =
@categoryID))
IF @bApprovalRequired = 0 BEGIN SET @bApproved = 1 END ELSE BEGIN SET @bApproved = 0 END IF @startDate IS NULL
SET @startDate = GETDATE() INSERT
INTO tblForumThread
(fkCategoryID, fkSomeoneID, threadHeader, threadBody, fkStatusID, startDate, expiryDate) VALUES (@categoryID, @someoneID, @header, @threadBody, @bApproved, @startDate, @expiryDate) -- Check if there are any errors IF NOT (@@ERROR = 0) BEGIN SET @bError = 1 END SET @newThreadID = @@IDENTITY -- Update category statistics, i.e. thread count, last post by etc. UPDATE tblForumCategory SET threadCount = threadCount + 1, fkLastPostByID = @someoneID, dateStamp = GETDATE() WHERE (pkCategoryID = @categoryID) -- Check if there are any errors IF NOT (@@ERROR = 0) BEGIN SET @bError = 1 END IF @bError = 1
BEGIN -- Rollback transaction if there was an error ROLLBACK TRANSACTION END ELSE BEGIN -- Commit transaction if there was no error COMMIT TRANSACTION END IF @bError = 0
BEGIN -- Reindex full-text catalog if required EXECUTE spFullTextIncremental '1' END GO I wrote a little procedure that keeps redirecting
the page untill the recordcount NEQ 0, but that is of course not the
solution.
TIA
Taco Fleur
---You are currently subscribed to cfaussie as: [email protected] To unsubscribe send a blank email to [EMAIL PROTECTED] MX Downunder AsiaPac DevCon - http://mxdu.com/ |
