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

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
 
E

Elliot Rodriguez

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.
 
J

johnston

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.
 
K

Kevin Spencer

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top