Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Difficulties to find solution for IF/ELSE constructionDifficulties to find solution for IF/ELSE construction
Previous
 
Next
New Post
8/26/2009 10:41 AM
 

In that case, you just need to negate the WHERE condition for the "else" branch:

   1:  UPDATE aspnet_Membership
   2:  SET IsLockedOut = 1
   3:  FROM
   4:    aspnet_Users au Left Outer Join
   5:    Users u On au.UserName = u.Username Inner Join
   6:    UserRoles ur On u.UserID = ur.UserID Inner Join
   7:    aspnet_Membership am On au.UserId = am.UserId
   8:  WHERE 
   9:    NOT (DateDiff(day, ur.ExpiryDate, GetDate()) Between -1 And 0
  10:    AND DateDiff(day, am.LastPasswordChangedDate, GetDate()) < 14)
  11:   
  12:  UPDATE UserRoles
  13:  SET ExpiryDate = DATEADD(year, 1, ur.ExpiryDate)
  14:  FROM
  15:    aspnet_Users au Left Outer Join
  16:    Users u On au.UserName = u.Username Inner Join
  17:    UserRoles ur On u.UserID = ur.UserID Inner Join
  18:    aspnet_Membership am On au.UserId = am.UserId
  19:  WHERE 
  20:    DateDiff(day, ur.ExpiryDate, GetDate()) Between -1 And 0
  21:    AND DateDiff(day, am.LastPasswordChangedDate, GetDate()) < 14

You'll also need to run the "else" branch first, since the other branch updates ExpiryDate (invalidating the WHERE condition)

Hope it helps,


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
9/2/2009 5:34 AM
 

Hello Brian,

Thank you very much, this has helped me a lot and from here i can implement a fine solution!

One last question, if i may... What's the easiest way to export results from a query to, lets's say an excel sheet or word document, from that query itself or from a script? This is to be able to run these exports automatic...

 

Thank you again in advance,

Mart

 

 
New Post
9/2/2009 2:21 PM
 

Unfortunately, I don't know of an easy way to export the results of a query to a file from the query or a script.  It would probably be a good idea to post that as a new question on the forum (or maybe on stackoverflow.com) and see if someone elseknows of a good solution for you.

Hope it helps,


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Difficulties to find solution for IF/ELSE constructionDifficulties to find solution for IF/ELSE construction


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out