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

Ask a Question related to ASP Database, Design and Development.

  1. #1

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

    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
    johnston Guest

  2. Similar Questions and Discussions

    1. Master Pages won't apply to certain document pages
      Hello. I'm working on a book and using a couple of simple master pages. On certain live pages the master pages objects don't show up, but they do on...
    2. Global changes to all Master Pages in a Book
      #15 I guess the simple answer is it depends on your hardware. Also, there is the matter of file corruption. It's always good to put your eggs in...
    3. How to print 3 small pages wide by 5 pages tall in one spread?
      Hi Vincent, I'm having a similar problem. My dilemma is that I've created a raffle ticket design and to save paper have tiled them 5 to an A4...
    4. Global Error handling in Applicatio_Error() of Global.asax
      Hi all, For a web application if we are using web farm, and if i want to do Global Error handling can i use Applicatio_Error() method in...
    5. Help Please: 'Warning 5001 global variable "iF_timer" already defined in global scope
      Hi there, I have just started to get this error: 'Warning 5001 global variable "iF_timer" already defined in global scope The variable name...
  3. #2

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

    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
    johnston Guest

  4. #3

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



    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
    johnston Guest

  5. #4

    Default Re: Is there way to do global changes to SQL in ASP pages

    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
    [url]www.notetab.com[/url].


    --
    Elliot M. Rodriguez, MCSD
    *** It would take 227 cans of Mountain Dew to kill me***



    "johnston" <johnston@thot.com> wrote in message
    news:3f154ff3$0$68854$45beb828@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

    Elliot Rodriguez Guest

  6. #5

    Default Re: Is there way to do global changes to SQL in ASP pages

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


    Randy R Guest

  7. #6

    Default Re: Is there way to do global changes to SQL in ASP pages

    This might be a good time to switch to using stored procedures.



    "johnston" <johnston@thot.com> wrote in message
    news:3f154fcc$0$68854$45beb828@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

    Aaron Bertrand - MVP Guest

  8. #7

    Default Re: Is there way to do global changes to SQL in ASP pages

    There is some useful information here: [url]http://www.aspfaq.com/5003[/url]



    "johnston" <johnston@thot.com> wrote in message
    news:3f155013$0$68854$45beb828@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

    Aaron Bertrand - MVP Guest

  9. #8

    Default Re: Is there way to do global changes to SQL in ASP pages

    [url]http://www.aspfaq.com/2201[/url]
    [url]http://www.aspfaq.com/2423[/url]




    "johnston" <johnston@thot.com> wrote in message
    news:3f155973$0$68854$45beb828@newscene.com...
    > In article <OTpGV55SDHA.1576@TK2MSFTNGP12.phx.gbl>, "Aaron Bertrand - MVP"
    <aaron@TRASHaspfaq.com> wrote:
    > >This might be a good time to switch to using stored procedures.
    > >
    > >
    > >
    > >"johnston" <johnston@thot.com> wrote in message
    > >news:3f154fcc$0$68854$45beb828@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

    Aaron Bertrand - MVP Guest

  10. #9

    Default Re: Is there way to do global changes to SQL in ASP pages

    In article <#mIY5H6SDHA.940@TK2MSFTNGP11.phx.gbl>, "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote:
    >There is some useful information here: [url]http://www.aspfaq.com/5003[/url]
    >
    >
    >
    >"johnston" <johnston@thot.com> wrote in message
    >news:3f155013$0$68854$45beb828@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
    >
    >
    didn't know you were a comedian in addition to an MVP!
    johnston Guest

  11. #10

    Default Re: Is there way to do global changes to SQL in ASP pages

    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" <shuckle@hotmail.com> wrote in message
    news:OaV71a7SDHA.3636@tk2msftngp13.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" <aaron@TRASHaspfaq.com> wrote in message
    > news:OTpGV55SDHA.1576@TK2MSFTNGP12.phx.gbl...
    > > This might be a good time to switch to using stored procedures.
    > >
    > >
    > >
    > > "johnston" <johnston@thot.com> wrote in message
    > > news:3f154fcc$0$68854$45beb828@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
    > >
    > >
    >
    >

    Ray at Guest

  12. #11

    Default Re: Is there way to do global changes to SQL in ASP pages

    > 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*. :-)


    Aaron Bertrand - MVP Guest

  13. #12

    Default Re: Is there way to do global changes to SQL in ASP pages

    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%>" <ask@me.forit> wrote in message
    news:u9ep$e7SDHA.2256@TK2MSFTNGP11.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" <shuckle@hotmail.com> wrote in message
    > news:OaV71a7SDHA.3636@tk2msftngp13.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" <aaron@TRASHaspfaq.com> wrote in message
    > > news:OTpGV55SDHA.1576@TK2MSFTNGP12.phx.gbl...
    > > > This might be a good time to switch to using stored procedures.
    > > >
    > > >
    > > >
    > > > "johnston" <johnston@thot.com> wrote in message
    > > > news:3f154fcc$0$68854$45beb828@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
    > > >
    > > >
    > >
    > >
    >
    >

    jason kennedy Guest

  14. #13

    Default Re: Is there way to do global changes to SQL in ASP pages

    On 16 Jul 2003 08:17:11 -0500, [email]johnston@thot.com[/email] (johnston) wrote:
    >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
    Global search and replace in your favorite code editor...

    Jeff
    ===================================
    Jeff Cochran (IIS MVP)
    [email]jcochran.nospam@naplesgov.com[/email] - 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:
    [url]http://www.iisfaq.com/[/url]
    [url]http://www.iisanswers.com/[/url]
    [url]http://www.iistoolshed.com/[/url]
    [url]http://securityadmin.info/[/url]
    [url]http://www.aspfaq.com/[/url]
    [url]http://support.microsoft.com/[/url]
    ====================================
    Jeff Cochran Guest

  15. #14

    Default Re: Is there way to do global changes to SQL in ASP pages

    In article <u9ep$e7SDHA.2256@TK2MSFTNGP11.phx.gbl>, "Ray at <%=sLocation%>" <ask@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" <shuckle@hotmail.com> wrote in message
    >news:OaV71a7SDHA.3636@tk2msftngp13.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" <aaron@TRASHaspfaq.com> wrote in message
    >> news:OTpGV55SDHA.1576@TK2MSFTNGP12.phx.gbl...
    >> > This might be a good time to switch to using stored procedures.
    >> >
    >> >
    >> >
    >> > "johnston" <johnston@thot.com> wrote in message
    >> > news:3f154fcc$0$68854$45beb828@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
    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
    >> >
    >> >
    >>
    >>
    >
    >
    johnston Guest

  16. #15

    Default Re: Is there way to do global changes to SQL in ASP pages

    In article <Ox6OuT8SDHA.940@TK2MSFTNGP11.phx.gbl>, "Kevin Spencer" <kevin@takempis.com> wrote:
    >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.

    johnston Guest

  17. #16

    Default Re: Is there way to do global changes to SQL in ASP pages

    "johnston" <johnston@thot.com> wrote in message
    news:3f154fcc$0$68854$45beb828@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
    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_components_new
    2. Create a view/saved query called distribution_table 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?


    Chris Hohmann Guest

  18. #17

    Default Re: Is there way to do global changes to SQL in ASP pages

    In article <eu9Ive#SDHA.1036@TK2MSFTNGP10.phx.gbl>, "Chris Hohmann" <hohmannATyahooDOTcom> wrote:
    >
    >That being said, another option available to you is to the following:
    >
    >1. Call the new table distribution_components_new
    >2. Create a view/saved query called distribution_table 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?
    >
    >
    the session variable is from the web page, its not in the database.
    johnston Guest

  19. #18

    Default Re: Is there way to do global changes to SQL in ASP pages

    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
    [url]http://www.takempis.com[/url]
    Big things are made up of
    lots of little things.

    "johnston" <johnston@thot.com> wrote in message
    news:3f15cd14$0$68854$45beb828@newscene.com...
    > In article <Ox6OuT8SDHA.940@TK2MSFTNGP11.phx.gbl>, "Kevin Spencer"
    <kevin@takempis.com> wrote:
    > >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.
    >

    Kevin Spencer Guest

  20. #19

    Default Re: Is there way to do global changes to SQL in ASP pages

    "johnston" <johnston@thot.com> wrote in message
    news:3f168fa3$0$68854$45beb828@newscene.com...
    > In article <eu9Ive#SDHA.1036@TK2MSFTNGP10.phx.gbl>, "Chris Hohmann"
    <hohmannATyahooDOTcom> wrote:
    > >
    > >That being said, another option available to you is to the following:
    > >
    > >1. Call the new table distribution_components_new
    > >2. Create a view/saved query called distribution_table 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?
    > >
    > >
    > the session variable is from the web page, its not in the database.
    What is it? When is it created? Can it be stored in the database?


    Chris Hohmann Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139