Solved

Invalid Column Name SQL error after renaming table field name

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now