473,666 Members | 2,331 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 1138
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
15873
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 mechanism in PHP?
5
3839
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 application in the title bar. For example, the user starts the application, and the title bar says "Control Panel". The user starts another instance of the application, and it knows that one instance is already running, so the title bar of the...
2
2717
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 application variable. I'm trying to replicate this in .NET, but I'm using a data access layer (DAL) that's in a seperate project. Obviously, the DAL can't see the application variables. I was thinking of passing the application state in the...
3
2511
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 should be stored in a global variable, but it shouldn't be possible to modify this variable. so what i tried first was using the application object to store that string. that was fine, but the problem is, that it can be modified from outside, so...
4
1655
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 System.Web.HttpApplication but it does not seem to like that one bit. I also have a MSXML2.DOMDocument30 defined as a public object within the vb module which is loaded during the application start up with a bunch of XML. What is weird is that the data contained...
9
2448
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 at http://www.lamartin.com/dotnet/sessiontestset.aspx, were I set Session, Application and Cache variables on the first page and then on the second page view them as the second page is refreshed every five seconds. Before 10 refreshes, the...
7
2162
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 got is a decodeImage.aspx page that gets called to decode base64 encoded images and return them as displayable images to a Web page. The ASPX page is passed two parameters, "file" and "img". The "file" parameter specifies and XML file on the Web...
20
4453
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 logic layer(so far so good and easy).I initialize my class which is using a FileSystemWatcher in my Global.asax and everything works fine.I have found FileSystemWatcher class not very reliable and sometimes it behavies unexpectedly.I'm afriad that...
2
1237
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 seems to disappear when the users session times out. What really weird is that it works fine on my development box; but flakes out on the server. I added a button to a dummy webpage to reload the Application variable; but it still disappears...
7
2231
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 application variable with domain 1, the app variable is sharing across all domains using that IP address - this is correct? This is the behavior I am seeing and I want to make sure that my server is set up correct. I especially want to make sure...
0
8356
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8866
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
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
8550
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
8639
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...
0
5663
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
4198
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
4366
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1772
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.