473,508 Members | 2,046 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application Variable

geo039
47 New Member
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.
Jul 24 '07 #1
2 1134
radcaesar
759 Recognized Expert Contributor
Why did u prefer to use application variable for this requirement. If a update has already done on that date, use a flag and date column in the DB itself for your check. If the flag is set then show a message to the user by check that date with today's date.
Jul 24 '07 #2
geo039
47 New Member
I'm new to all this just learning. I talked to a few other developers here and both using a column and flag and application variable came up. When my boss wrote down what to do he said to start with setting the application variable to date(today). Then write the sp. Right now i'm sort of confused about the best way to accomplish this.

I don't know how to use a flag. The inherited sp currently looks like this. I say inherited because I took an application another dept uses to modify it to our needs. They are using a view to insert new employees, we will be checking whether an employee personnel # exists, if so then update if not then insert. I am trying to figure out their logic, apply our logic and learn what i'm doing at the same time =)

Expand|Select|Wrap|Line Numbers
  1. -- insert newly found employees
  2. INSERT INTO dbo.employee
  3.     (NTusername, full_name, cost_center, location, job_title, supervisor )
  4. SELECT empUserName, full_name, cdcstcntr, cdlocation, job_title, supervisor_name
  5. FROM dbo.v_wqtimenewemployees
  6.  
  7. -- update fields in the employee table
  8. UPDATE  dbo.employee 
  9. SET full_name = t.full_name, cost_center = t.cdcstcntr,
  10.     cost_center_desc=t.desccstcntr, job_title=t.job_title,
  11.     supervisor=t.supervisor_name
  12. FROM dbo.v_WQTimeEmployees as t RIGHT OUTER JOIN 
  13.     dbo.employee ON t.empUserName = dbo.employee.NTUsername
  14. WHERE t.empUserName = dbo.employee.NTUsername 
  15.     AND (dbo.employee.manual IS NULL or dbo.employee.manual=0) 
  16.  
  17. -- update location if it is set for automatic updates
  18. UPDATE  dbo.employee 
  19. SET location=t.cdlocation
  20. FROM dbo.v_WQTimeEmployees as t RIGHT OUTER JOIN 
  21.     dbo.employee ON t.empUserName = dbo.employee.NTUsername
  22. WHERE t.empUserName = dbo.employee.NTUsername 
  23.     AND (dbo.employee.manual_loc IS NULL or dbo.employee.manual_loc=0)
  24.  
  25. -- archive those no longer in wqtime
  26. UPDATE  dbo.employee
  27. SET inactive = '1'
  28. FROM dbo.v_WQTimeEmployees RIGHT OUTER JOIN 
  29.     dbo.employee ON dbo.v_WQTimeEmployees.empUserName 
  30.     = dbo.employee.NTUsername
  31. WHERE (dbo.v_WQTimeEmployees.empUserName IS NULL) 
  32.     AND (dbo.employee.manual IS NULL or dbo.employee.manual=0) 
  33.         AND (dbo.employee.inactive is null or dbo.employee.inactive=0)
Jul 24 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

33
15831
by: aa | last post by:
I am migrating to PHP from ASP where there are the Application Scope variables which are accessible from any page on a website and which are used, in particular, for hit counters. Is there a similar...
5
3824
by: Mark Fisher | last post by:
I have a Java desktop GUI application that the user can run multiple times. In order to keep one instance of the application distinct from another, I'd like to put the instance number of the...
2
2707
by: Duncan Welch | last post by:
Good morning, I have a classic ASP app that I'm converting to .NET. In the existing app when accessing infrequntly changed data, it reads a database once a day, and saves the results in an...
3
2502
by: Patrick | last post by:
Hi I have the following problem. When starting my asp.net application, i read a encrypted string from a file, decrypt it and want this values to be available in the complete application. they...
4
1641
by: Keith Chadwick | last post by:
I am having some trouble referencing an Application("myVar") variable from within a module.vb file on my ASP.NET site. According to the documentation I should be able to reference...
9
2438
by: William LaMartin | last post by:
I have a problem, mentioned here before, of Session and Application variables disappearing at one site but not at others or on my development computer. The problem is illustrated by an example...
7
2150
by: Greg Collins [MVP] | last post by:
Hi, I couldn't find what I was looking for by searching the newsgroup, but perhaps these have already been discussed somewhere. This is a bit long with a lot of interrelated questions. What I've...
20
4415
by: J-T | last post by:
We are working on an asp.net application which is a 3-tier application.I was aksed to create a component which monitors a folder and gets the file and pass them to a class library in our business...
2
1235
by: Frank_00001 | last post by:
I've migrated an application from VS 2003 to VS 2005. It worked fine in 2003; but I've been having issue in 2005. The latest is dealing with a DataSet that I have as an Application Variable. It...
7
2223
by: Victor | last post by:
I've got two domain names sharing the same IP address that use ASP VBScript If I set a session variable with domain 1, it is only available for domain 1 - this is correct? If I set an...
0
7226
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7499
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...
0
5631
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5055
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...
0
4709
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...
0
1561
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 ...
1
767
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
422
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...

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.