Print Page | Close Window

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

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=25918
Printed Date: 28 March 2026 at 9:08am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: How to check/update yes/no fields and set date
Posted By: Nerz
Subject: How to check/update yes/no fields and set date
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?



Replies:
Posted By: jamie.townsend
Date 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


Posted By: Nerz
Date 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


Posted By: jamie.townsend
Date Posted: 30 June 2008 at 4:46pm
rsProjDatabase2.Fields("IP") = Address
rsProjDatabase2.Fields("ID") = Request.Form("ID")
rsProjDatabase2.Fields("User Agreement") = true


Posted By: Nerz
Date 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)


Posted By: Jono
Date 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 - 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 - 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 - 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net