asp.net - The Ghost of a Renamed Table -


i have renamed table in sql server 2008 database, el_coursestepusernotes stepusernotes. renamed table using ssma.

the table used in asp.net 4.0 app. use linq sql crud. problem following code:

    dbdatacontext db = new dbdatacontext();     var k = (from c in db.stepusernotes              ((c.coursestepfk == q.coursestepfk) && (c.userfk == q.userfk))              select c).firstordefault();     try     {         db.stepusernotes.insertonsubmit(q);         db.submitchanges();     }     catch     {      } 

fails on db.submitchanges line, saying:

sqlexception caught. invalid object name 'el_coursestepusernotes'. 

ie, old name table has come haunt me.

i have deleted old linq sql dbml file , created new one. have searched through source code strings contain old table name. nothing. code compiles...

where else can look?

the error coming sql server, , using utility listing foreign keys in sql server database shown in question: sql:need change constraint on rename table?

reveals no sign of old table name in fks either.

i @ complete loss or try next. suggestions?

answer:

the problem, stated stu , stark trigger. stu gave me sql run nailed problem. documented here in case else runs this:

select object_name(id) syscomments         text '%el_coursestepusernotes%' 

this revealed trigger following name:

tr_el_coursestepusernotes 

the trigger referenced old name follows:

set dateamended = current_timestamp      el_coursestepusernotes pp               inner join inserted  on pp.usernoteid = i.usernoteid 

everything working again.

silly me, should have realised trigger problem first error got related dateamended field.

i have no idea why trigger update when table name changed. had checked keys , relationships, forgot trigger.

live , learn.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -