DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Application Variable

  1. #1
    Join Date
    Nov 2006
    Posts
    29

    Question Application Variable

    I need to set my asp.net application variable to today's date so it can check when a last database refresh was done. I have data coming from one view into a table used by my application so I need to insert or update based on if data exists or not.

    Basically I just need the update to run once a day so the variable just needs to check to see if it was run each day. So every time the application loads, if the refresh was run today don't run again if so run??

    I'm pretty new to this so any help would be appreciated.

  2. #2
    Join Date
    Feb 2007
    Posts
    35
    Not sure what database you're using but sounds to me that this problem should be handled by the database and not the application. Most database has nice functionality for that.
    Otherwise, just record the date of last update in the database, and get it to check against today's date before doing insert/update.

  3. #3
    Join Date
    Nov 2006
    Posts
    29

    Question

    I'm using SQL Server 2005. Since i'm new and learning my boss said to write a sp to update/insert into say table B. Meaning if employee # is found in B then update if not then insert. He said to see the application variable and set the date to today so every time i load the app, check if date = today if yes don't run sp if no run sp.

    If there is a better way, maybe you can describe it a lil more, it would be helpful.

  4. #4
    Join Date
    Feb 2007
    Posts
    35
    Then, you have your solution right ?
    I mean, check the date from the application, if it's equal to today then call the SP, otherwise do nothing.
    Let the SP to handle whether it's an insert or update (otherwise you can make another if-else in the .Net code, and you don't even need to have SP anymore).
    I would suggest to avoid SP as having everything in 1 code is easier for debugging and maintenance purpose (though I guess, SP might be slimly faster), but in practical, if you're more confident in .Net then do it in the code, if you're more confident on TSQL then do it in SP

  5. #5
    Join Date
    Nov 2006
    Posts
    29

    Question

    Actually I've moved on to another part of the application because I could not 1) figure out how to even set the date to today in the application variable. I understand it's probably today.date or something, and 2) I was not sure where to put the logic for the if/else statement

    The most confusing part of this learning experience is 1) when to use the db and when to use the app. I guess sample syntax would be help.

    Do I put the entire logic in the application variable?

Similar Threads

  1. XML config with Java application
    By redeville in forum Java
    Replies: 1
    Last Post: 01-16-2007, 04:05 AM
  2. Application Variables lose data
    By AC in forum ASP.NET
    Replies: 1
    Last Post: 03-03-2003, 04:03 PM
  3. Inventory Management Application Using VB
    By Krishna in forum vb.announcements
    Replies: 0
    Last Post: 11-26-2002, 12:03 AM
  4. Replies: 3
    Last Post: 01-26-2001, 03:22 PM
  5. Capturing mouse clicks outside VB Application
    By Sunil in forum VB Classic
    Replies: 0
    Last Post: 07-28-2000, 08:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center