Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - How to check/update yes/no fields and set date
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to check/update yes/no fields and set date

 Post Reply Post Reply
Author
Nerz View Drop Down
Newbie
Newbie


Joined: 23 June 2008
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote Nerz Quote  Post ReplyReply Direct Link To This Post Topic: How to check/update yes/no fields and set date
    Posted: 30 June 2008 at 3:09pm
I know i've been asking alot of questions. It's just that I'm new to asp and this forum's members are helpful.
 
Anyway my question is how do i check/update yes/no fields of a DB. Also how can i set the current date plus 2 weeks in a date/time field with the format being general date (6/30/08). And to save some time how can i check today's date against it?
Back to Top
jamie.townsend View Drop Down
Groupie
Groupie


Joined: 07 December 2007
Location: England
Status: Offline
Points: 114
Post Options Post Options   Thanks (0) Thanks(0)   Quote jamie.townsend Quote  Post ReplyReply Direct Link To This Post Posted: 30 June 2008 at 3:42pm
It depends what database you are using if you are using Access, MYSQL then you use something like update table set boolean = true

Where as MSSQL you use 1 for true and 0 for false.

If you want to add a timespan onto a date then I suggest you look at the vbscript dateadd function http://www.w3schools.com/Vbscript/func_dateadd.asp
Back to Top
Nerz View Drop Down
Newbie
Newbie


Joined: 23 June 2008
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote Nerz Quote  Post ReplyReply Direct Link To This Post Posted: 30 June 2008 at 4:40pm
Kinda confused on the syntax. what do i have to change from this snippet?
 
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("ProjDatabase.mdb")

'Create an ADO recordset object
Set rsProjDatabase = Server.CreateObject("ADODB.Recordset")

rsProjDatabase2.Fields("IP") = Address
rsProjDatabase2.Fields("ID") = Request.Form("ID")
-->>>rsProjDatabase2.Fields("User Agreement") update set boolean = true
 
rsProjDatabase2.Update
Back to Top
jamie.townsend View Drop Down
Groupie
Groupie


Joined: 07 December 2007
Location: England
Status: Offline
Points: 114
Post Options Post Options   Thanks (0) Thanks(0)   Quote jamie.townsend Quote  Post ReplyReply Direct Link To This Post Posted: 30 June 2008 at 4:46pm
rsProjDatabase2.Fields("IP") = Address
rsProjDatabase2.Fields("ID") = Request.Form("ID")
rsProjDatabase2.Fields("User Agreement") = true
Back to Top
Nerz View Drop Down
Newbie
Newbie


Joined: 23 June 2008
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote Nerz Quote  Post ReplyReply Direct Link To This Post Posted: 30 June 2008 at 7:51pm

don't know why i thought it would be more complicated.

I've found a code snippet to view the date.
Response.Write ("The date on the server is: " & Date())

how can i change this to take the return from Date() to a variable and then print line.

though this i wrong its what i mean...
date = Date()
Response.Write(date)
Back to Top
Jono View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 18 September 2006
Location: United Kingdom
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jono Quote  Post ReplyReply Direct Link To This Post Posted: 30 June 2008 at 8:11pm
You were almost there, but you used "date" as a variable name.
 
dtmMyDate = Date()
Response.Write dtmMyDate
 
Should work for you. The Microsoft Scripting center is very good: http://www.microsoft.com/technet/scriptcenter/default.mspx and there is a link on the left to the vbScript language reference (http://msdn.microsoft.com/en-gb/library/d1wf56tt.aspx)  and you can also download it as a help file (http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en).
 
We're just too helpful on here at times.. Big%20smile
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.