Solved

Invalid Column Name SQL error after renaming table field name

Posted on 2008-10-21
3
849 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
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

809 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