Is there way to do global changes to SQL in ASP pages

  • Thread starter Thread starter johnston
  • Start date Start date
J

johnston

We have over 100 asp pages that reference a table (distribution_components).
We added a new column and primary key to that table, so now we have to modify
the where clause to include that column (we have to make the new column = to a
session variable in the page)

The table appears 531 times in our code. Is there some util or method that
allows us to change it globally, other than going to each occurrance, and
adding the new column to the where clause
 
I assume you didnt have the ability to write stored procs when you first
started out...

How do you know it appears 531 times? If you use VS.Net, or any other text
editor that has an MDI interface, you can do a find replace throughout your
pages to determine where the table name is, then add it.

A texteditor that has an MDI, in case you dont have one, is available at
www.notetab.com.
 
Are you telling us that you duplicated the same SQL query string 531 times
in your code?


No, it is different most of time. The table is referenced multiple times to
get different pieces of info, sometimes by istelf other times in a join.
 
Well, I think you're just going to have to bite the bullet here. This is one
case that brilliantly illustrates the necessity of having good program
architecture! ASP.Net pages are user interfaces, and as such, in a large
application, shouldn't have any direct database calls in them. It would have
been helpful to put your database calls into a class library, and your SQL
in Stored Procedures.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big things are made up of
lots of little things.
 
Back
Top