asp.net - "Invalid object name" after restoring SQL Server 2008 database -
asp.net - "Invalid object name" after restoring SQL Server 2008 database -
i'm switching web host , backed database. due restriction new host not restore .bak file , had send them restore it. 1 time had restored it, ran application this
system.data.sqlclient.sqlexception: invalid object name "<table name>"
whenever seek query table application. however, have no problems logging in through management studio same user name , password , querying tables.
i'm running mvc 3 site sql server 2008
does know why might getting these exceptions when trying run application?
edit:
some more information:
the user name using in old db kimpo54321 tables had created got prefixed kimpo54321. tried adding first query in web app select * kimpo54321.<tablename>
, query passed without exception.
now did not have prefix each table name before in application , don't want apply queries. there way prepare this?
edit:
i ran alter schema line each table , changed dbo
, working. thnx aaron pointing me in right direction finding answer
select 'alter schema dbo transfer ' + s.name + '.' + o.name sys.objects o inner bring together sys.schemas s on o.schema_id = s.schema_id s.name = 'yourschema' , (o.type = 'u' or o.type = 'p' or o.type = 'v')
are referencing schema (e.g. dbo.table vs. table)? possible user @ new host has different default schema @ old host. how "querying tables" - right-clicking , selecting 1 of options, or using exact same query issued application?
asp.net sql-server sql-server-2008 exception invalid-object-name
Comments
Post a Comment