Solved

Invalid Column Name SQL error after renaming table field name

Posted on 2008-10-21
3
856 Views
Last Modified: 2012-05-07
I am working in an ASP.Net project that I inherited.  I was doing some cleanup and found some table column names that were misspelled.  I wanted to rename the columns so that future searches would find all instances of this name.  So, I renamed the field in SQL using Enterprise Manager, then going to Design Table and then renaming the field.  Then, I updated all the code with the references to the column.

Now, when I am running debug testing, I get to the ExecuteNonQuery command (I am updating the table), I get the 'SqlException was caught' error.  The errors list 'Invalid column name 'oldname'.

There must be something cached somewhere but I'm not sure how to correct this.

We are running Visual Studio 2005, SQL2000.
Thanks for any help.
0
Comment
Question by:smodesitt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 7

Expert Comment

by:the_bachelor
ID: 22771540
Or simply the columname in the SQL statement doesn't match the one in the Database.
Triple Check..
0
 
LVL 2

Expert Comment

by:johnhumenik
ID: 22772160
Are you using a stored procedure or class layer to hit the database?  I would do a search on the whole project and make sure that you got all instances of the variable name updated.  If notthing else, post the code and table layout for review.  
0
 

Accepted Solution

by:
smodesitt earned 0 total points
ID: 22777487
I finally figured it out myself.  For some reason, when I renamed the field (didn't matter whether I did it in Enterprise Manager or using DBCC command in Query Analyzer), the Constraints and Triggers were not updated.  I finally updated those areas using Query Analyzer and all is good.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Suggested Courses

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question