Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Invalid Column Name SQL error after renaming table field name

Posted on 2008-10-21
3
Medium Priority
?
874 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

715 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