locked
database value double up prb. RRS feed

  • Question

  • hello guys,

    plz help me out........i made a project in c#......with using sql server 2005 as a back end.........now having a problem in this......that database value are doubling up automaticaly after somedays

     

    plz let me know guys if anybody have any clue...

     

    thanks

    Mordhawaj Chauhan

     

     

     

     

    Thursday, April 21, 2011 12:55 PM

Answers

  • I am sorry, but I do not understand your problem. 

    It sounds like your data in the database is increasing the values over time, so that in a few days a value doubles:  e.g.  1000 becomes 2000.  No value will change in your database without the change being made by some outside source, perhaps by the c# code that makes up your project.

    If there is no other process affecting your database, then you need to examine the code of your project.   You can post small portions of code here (use the HTML popup a above your message), but no one is going to read a whole project.

    A technical suggestion would be to put triggers on your affected tables.   The triggers can insert a row into a trace table each time a value of concern changes.  Then you can track what is happening.  E.g. something like:

    CREATE TABLE TraceProblem
    (tablename sysname,
    change_time datetime, 
    whodidit sysname,
    keyvalue varchar(20),
    oldvalue varchar(20),
    newvalue varchar(20));
    GO

    CREATE TRIGGER TraceTable1 ON dbo.Table1
    AFTER INSERT, UPDATE
    AS
    INSERT INTO TraceProblem 
    SELECT 'Table1', GETDATE(), SUSER_SNAME(), i.keyvalue, d.numcol, i.numcol
    FROM inserted i LEFT OUTER JOIN deleted d
       ON i.keyvalue = d.keyvalue
    GO

    That may help you to track the changes.  (Repeat the trigger for each involved table)

    RLF

    • Proposed as answer by Stephanie Lv Tuesday, April 26, 2011 12:13 AM
    • Marked as answer by WeiLin Qiao Thursday, April 28, 2011 11:28 AM
    Thursday, April 21, 2011 3:23 PM