473,699 Members | 2,531 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

We have over 100 asp pages that reference a table (distribution_c omponents).
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
Jul 19 '05 #1
11 1860
> 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


If the sql statements are exactly the same, you could do a global search and
replace using Visual Studio, or something similar. You could probably at
least knock a few off if you do a search and replace on various instances of
the sql statements.

Other than that, I'm not sure of any other way... I think you're out of
luck.
Jul 19 '05 #2
This might be a good time to switch to using stored procedures.

"johnston" <jo******@thot. com> wrote in message
news:3f******** *************** @newscene.com.. .
We have over 100 asp pages that reference a table (distribution_c omponents). 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

Jul 19 '05 #3
http://www.aspfaq.com/2201
http://www.aspfaq.com/2423


"johnston" <jo******@thot. com> wrote in message
news:3f******** *************** @newscene.com.. .
In article <OT************ **@TK2MSFTNGP12 .phx.gbl>, "Aaron Bertrand - MVP" <aa***@TRASHasp faq.com> wrote:
This might be a good time to switch to using stored procedures.

"johnston" <jo******@thot. com> wrote in message
news:3f******* *************** *@newscene.com. ..
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


do you have a good web page or article on doing that? Lots of people

sugguest it but i have yet to see a good expalnation with example

Jul 19 '05 #4
Or at least use a function to return an array of your data every place you
need it 531 times. Good lord. I don't mean this to sound rude johnston,
really, but let this be a lesson to you.

Ray at work

"TomB" <sh*****@hotmai l.com> wrote in message
news:Oa******** ******@tk2msftn gp13.phx.gbl...
I disagree.

A good time to switch to using stored procedures is before you've written
531 sql statements in your code.
"Aaron Bertrand - MVP" <aa***@TRASHasp faq.com> wrote in message
news:OT******** ******@TK2MSFTN GP12.phx.gbl...
This might be a good time to switch to using stored procedures.

"johnston" <jo******@thot. com> wrote in message
news:3f******** *************** @newscene.com.. .
We have over 100 asp pages that reference a table (distribution_c omponents).
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



Jul 19 '05 #5
> I disagree.

A good time to switch to using stored procedures is before you've written
531 sql statements in your code.


Well, given the lack of a time machine, this is probably the best time
*possible*. :-)
Jul 19 '05 #6
you can do a search and replace in dreamweaver through the current doc, a
particular folder, or your whole site.

or you could read in your ASP docs using fso and use a regular expression to
append to your SQL. you don't mention whether the 531 statements are exactly
the same

i'm not knocking you, but why are there 100 pages featuring an instance of
the same table? are you not passing values to it to return the required
results? if the table is identical, you could just supply that table as a
SSI, and then you'd only have had to update the SQL once.

for the future, maybe you should just stick with a SELECT * in your SQL till
you get your database design stabilised

good luck

Jason


"Ray at <%=sLocation% >" <as*@me.forit > wrote in message
news:u9******** ******@TK2MSFTN GP11.phx.gbl...
Or at least use a function to return an array of your data every place you
need it 531 times. Good lord. I don't mean this to sound rude johnston,
really, but let this be a lesson to you.

Ray at work

"TomB" <sh*****@hotmai l.com> wrote in message
news:Oa******** ******@tk2msftn gp13.phx.gbl...
I disagree.

A good time to switch to using stored procedures is before you've written
531 sql statements in your code.
"Aaron Bertrand - MVP" <aa***@TRASHasp faq.com> wrote in message
news:OT******** ******@TK2MSFTN GP12.phx.gbl...
This might be a good time to switch to using stored procedures.

"johnston" <jo******@thot. com> wrote in message
news:3f******** *************** @newscene.com.. .
> We have over 100 asp pages that reference a table
(distribution_c omponents).
> 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



Jul 19 '05 #7
On 16 Jul 2003 08:17:11 -0500, jo******@thot.c om (johnston) wrote:
We have over 100 asp pages that reference a table (distribution_c omponents).
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


Global search and replace in your favorite code editor...

Jeff
=============== =============== =====
Jeff Cochran (IIS MVP)
jc************* @naplesgov.com - Munged of Course

I don't get much time to respond to direct email,
so posts here will have a better chance of getting
an answer. Besides, everyone benefits here.

Suggested resources:
http://www.iisfaq.com/
http://www.iisanswers.com/
http://www.iistoolshed.com/
http://securityadmin.info/
http://www.aspfaq.com/
http://support.microsoft.com/
=============== =============== ======
Jul 19 '05 #8
In article <u9************ **@TK2MSFTNGP11 .phx.gbl>, "Ray at <%=sLocation% >" <as*@me.forit > wrote:
Or at least use a function to return an array of your data every place you
need it 531 times. Good lord. I don't mean this to sound rude johnston,
really, but let this be a lesson to you.

Ray at work

"TomB" <sh*****@hotmai l.com> wrote in message
news:Oa******* *******@tk2msft ngp13.phx.gbl.. .
I disagree.

A good time to switch to using stored procedures is before you've written
531 sql statements in your code.
"Aaron Bertrand - MVP" <aa***@TRASHasp faq.com> wrote in message
news:OT******** ******@TK2MSFTN GP12.phx.gbl...
> This might be a good time to switch to using stored procedures.
>
>
>
> "johnston" <jo******@thot. com> wrote in message
> news:3f******** *************** @newscene.com.. .
> > We have over 100 asp pages that reference a table
> (distribution_c omponents).
> > 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 newcolumn
=
> to a
i have an oracle background and came to the group that does asp programming.
I have been telling anybody that will listen that we should not use naked sql
in our asp pages, it should be done via a stored procedure.

It is either
stored procedures are for backend stuff not frontend
or
great idea, but this project is too small or deadline is too close, too much
time to develop them, we will surely use it next project, which of course is
also too small or deadline is too close
> > 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
>
>



Jul 19 '05 #9
"johnston" <jo******@thot. com> wrote in message
news:3f******** *************** @newscene.com.. .
We have over 100 asp pages that reference a table (distribution_c omponents). 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


WARNING: The following is only suggested for this particular
circumstance. As you have heard from others, a stored procedure would
have been the preferred way to handle this.

That being said, another option available to you is to the following:

1. Call the new table distribution_co mponents_new
2. Create a view/saved query called distribution_ta ble based on the new
table which reproduces the old table with the appropriate where clause
applied.

I don't know what the session variable is but I suspect it's something
available from the database. Could you provide some more details?
Jul 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2857
by: Jon Maz | last post by:
Hi All, I've just noticed that there seem to be two ways of setting up a global.asax file. At http://www.csharphelp.com/archives/archive206.html the global.asax example has Application_Start etc within <script runat="server"> ... </script> tags, whereas VS.Net creates a global.asax.cs file that is presumably pre-compiled like a .aspx.cs file.
3
7179
by: Faisal | last post by:
Hi. I'm in the process of moving an application from ASP to ASP.NET, & I'm writing in VB, using VS.NET. I'm new to the .NET framework & have a basic question regarding static objects defined in global.asax. In the global.asax file I want to declare some static objects (like an ADODB.Connection, an ADODB.Recordset, a Scripting.FileSystemObject...), and so I've done so using object tags. For example I have:
4
3534
by: BB | last post by:
Hello all, I might be missing something here, but am trying to understand the difference between using application-level variables--i.e. Application("MyVar")--and global variables--i.e. public myVar as string, etc. It seems to me that the scope and duration are the same, as they both are there while the application is running, and both go away when it quits. I presume that one difference is that the application state can be "flushed," such...
22
3780
by: fd123456 | last post by:
Hi Tom ! Sorry about the messy quoting, Google is playing tricks on me at the moment. > Global.asax is where you normally have the Global Application > and Session variables and code to manipulate them. It starts > and ends with <script></script> tags. > > Yours looks like a compiled version of it.
12
3820
by: John M | last post by:
Hello, On Microsoft Visual Studio .NET 2003, I want to use some global elements, that can be used in each one of my pages. i.e I put a oleDBConnection on global.asax.vb How can I use it (the oleDBConnection on global.asa.vb) at the other aspx pages ?
14
1657
by: Alan Silver | last post by:
Hello, I have spent ages trawling through Google, looking for information about global functions in ASP.NET and I'm still not clear about the best way to go about this (or not). I am writing a site that will be for members only. They will have to log in to gain access to any of the pages. I am holding the user information in an XML file (there will probably never be a large number of user, so this is efficient enough).
8
5674
by: Thomas Coleman | last post by:
Ok, I've obviously discovered that Global.aspx has been completely changed in ..NET 2.0. However, I haven't figured out how to declare a constant that's available to any page in my application without having to jump through a bunch of hoops. First, let me layout how it worked in 1.1. In the Global.asax, within the Global class construct, I would simply add something like: public const string FOO = "foo";
4
1679
by: Grant Merwitz | last post by:
Hi Is there a way to add a control to my page through the Global.asax I would like to place this code in the Session_Start page so its only added to the first page the user visits. TIA
2
1634
by: P K | last post by:
Hi, I have an Enum which I need to use in many pages and many classes written in asp.net 2.0 I would like to have a central repository for the enum so that changes can be made once. Also I would like a global access to it, meaning any page should be able to access it. How can I achieve this ?
2
3706
by: Steve | last post by:
I am new to this newsgroup & to .NET in general. I have been playing around with Visual Studio .NET, building and rendering web pages using VB "code behind" files. My problem / question is; How do I ensure that changes made to the "Global.asax.vb" file are immediately reflected in the "Global.asax" file? After I change to the "Global.asax.vb" file, the "Global.asax" file date modified does not change and I do not see the updated values...
0
9038
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8920
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8887
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6536
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3060
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2012
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.