Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: DateDiff Differences - Access vs SQL


Message #1 by "Steve Greenstein" <stevegrn@s...> on Mon, 18 Dec 2000 14:59:44 -0800
I'm moving all our website databases, which are currently in Microsoft

Access to SQL Server 7. I've run into a problem in several lines of code

where I use the DateDiff function.



Currently in Access, using VBScript in Active Server Pages, I'm using



If DateDiff("d",rstblAYPStudents("HoldDate"),Now()) < 4 THEN



I've converted the statement for SQL Server to:



If DateDiff(d,rstblAYPStudents("HoldDate"),GetDate()) < 4 THEN



but now get the error message "Invalid procedure call or argument:

'DateDiff'"



Am I coding this wrong?



Steve





--- 

NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS?  Is FREE okay?

Visit EarthWeb for the latest in IT Management, Software Development, 

Web Development, Networking & Communications, and Hardware & Systems.  

Click on http://www.earthweb.com for FREE articles, tutorials,

and discussions from the experts.

---

You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com

Message #2 by "Ken Schaefer" <ken@a...> on Tue, 19 Dec 2000 12:47:57 +1100
Steve,



Are you passing the DateDiff() in ASP, or in an SQL statement?



Cheers

Ken



----- Original Message ----- 

From: "Steve Greenstein" <stevegrn@s...>

To: "ASP Databases" <asp_databases@p...>

Sent: Tuesday, December 19, 2000 9:59 AM

Subject: [asp_databases] DateDiff Differences - Access vs SQL





> I'm moving all our website databases, which are currently in Microsoft

> Access to SQL Server 7. I've run into a problem in several lines of code

> where I use the DateDiff function.

> 

> Currently in Access, using VBScript in Active Server Pages, I'm using

> 

> If DateDiff("d",rstblAYPStudents("HoldDate"),Now()) < 4 THEN

> 

> I've converted the statement for SQL Server to:

> 

> If DateDiff(d,rstblAYPStudents("HoldDate"),GetDate()) < 4 THEN

> 

> but now get the error message "Invalid procedure call or argument:

> 'DateDiff'"

> 

> Am I coding this wrong?

> 

> Steve







---

FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS

IN YOUR INBOX!

Get the latest and best HTML, XML, and JavaScript tips, tools, and 

developments from the experts.  Sign up for one or more of EarthWeb's

FREE IT newsletters at http://www.earthweb.com today!  

---

You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com

Message #3 by "Dallas Martin" <dmartin@z...> on Mon, 18 Dec 2000 20:46:08 -0500
enclosed the "d" parameter in quotes



DateDiff("d",rstblAYPStudents("HoldDate"),GetDate()) < 4



hth,

DM



----- Original Message -----

From: "Steve Greenstein" <stevegrn@s...>

To: "ASP Databases" <asp_databases@p...>

Sent: Monday, December 18, 2000 5:59 PM

Subject: [asp_databases] DateDiff Differences - Access vs SQL





> I'm moving all our website databases, which are currently in Microsoft

> Access to SQL Server 7. I've run into a problem in several lines of code

> where I use the DateDiff function.

>

> Currently in Access, using VBScript in Active Server Pages, I'm using

>

> If DateDiff("d",rstblAYPStudents("HoldDate"),Now()) < 4 THEN

>

> I've converted the statement for SQL Server to:

>

> If DateDiff(d,rstblAYPStudents("HoldDate"),GetDate()) < 4 THEN

>

> but now get the error message "Invalid procedure call or argument:

> 'DateDiff'"

>

> Am I coding this wrong?

>

> Steve

>

>

---

FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS

IN YOUR INBOX!

Get the latest and best HTML, XML, and JavaScript tips, tools, and 

developments from the experts.  Sign up for one or more of EarthWeb's

FREE IT newsletters at http://www.earthweb.com today!  

---

You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com

Message #4 by "Steve Greenstein" <stevegrn@s...> on Mon, 18 Dec 2000 18:45:44 -0800
ASP. Here's the whole section of code:



If (DateDiff("d",(rstblAYPStudents("HoldDate")),(Now())) < 4) THEN

   Response.Write "<TD BACKGROUND='graphics/bluechalk.jpg'

ALIGN='CENTER'><FONT FACE='Arial, Helvetica' SIZE='1' COLOR='#FF0000'><B>On

Hold</B></FONT></TD>"

   ELSE

   Response.Write "<TD BACKGROUND='graphics/bluechalk.jpg'

ALIGN='CENTER'> </TD>"

  End If



Steve





----- Original Message -----

From: "Ken Schaefer" <ken@a...>

To: "ASP Databases" <asp_databases@p...>

Sent: Monday, December 18, 2000 5:47 PM

Subject: [asp_databases] Re: DateDiff Differences - Access vs SQL





> Steve,

>

> Are you passing the DateDiff() in ASP, or in an SQL statement?

>

> Cheers

> Ken

>

> ----- Original Message -----

> From: "Steve Greenstein" <stevegrn@s...>

> To: "ASP Databases" <asp_databases@p...>

> Sent: Tuesday, December 19, 2000 9:59 AM

> Subject: [asp_databases] DateDiff Differences - Access vs SQL

>

>

> > I'm moving all our website databases, which are currently in Microsoft

> > Access to SQL Server 7. I've run into a problem in several lines of code

> > where I use the DateDiff function.

> >

> > Currently in Access, using VBScript in Active Server Pages, I'm using

> >

> > If DateDiff("d",rstblAYPStudents("HoldDate"),Now()) < 4 THEN

> >

> > I've converted the statement for SQL Server to:

> >

> > If DateDiff(d,rstblAYPStudents("HoldDate"),GetDate()) < 4 THEN

> >

> > but now get the error message "Invalid procedure call or argument:

> > 'DateDiff'"

> >

> > Am I coding this wrong?

> >

> > Steve

>

---

FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS

IN YOUR INBOX!

Get the latest and best HTML, XML, and JavaScript tips, tools, and 

developments from the experts.  Sign up for one or more of EarthWeb's

FREE IT newsletters at http://www.earthweb.com today!  

---

You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com

Message #5 by "Steve Greenstein" <stevegrn@s...> on Tue, 19 Dec 2000 09:02:20 -0800
Thanks Dallas, but, unfortunately, this was one of the first things I tried.

That would make the statement:



If DateDiff("d",rstblAYPStudents("HoldDate"),getdate()) <4 Then



But, it doesn't work. I get this error message:

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'getdate'

chi/inboundSQLServer/inbound2.asp, line 179



Thanks,

Steve



----- Original Message -----

From: "Dallas Martin" <dmartin@z...>

To: "ASP Databases" <asp_databases@p...>

Sent: Monday, December 18, 2000 5:46 PM

Subject: [asp_databases] Re: DateDiff Differences - Access vs SQL





> enclosed the "d" parameter in quotes

>

> DateDiff("d",rstblAYPStudents("HoldDate"),GetDate()) < 4

>

> hth,

> DM

>

> ----- Original Message -----

> From: "Steve Greenstein" <stevegrn@s...>

> To: "ASP Databases" <asp_databases@p...>

> Sent: Monday, December 18, 2000 5:59 PM

> Subject: [asp_databases] DateDiff Differences - Access vs SQL

>

>

> > I'm moving all our website databases, which are currently in Microsoft

> > Access to SQL Server 7. I've run into a problem in several lines of code

> > where I use the DateDiff function.

> >

> > Currently in Access, using VBScript in Active Server Pages, I'm using

> >

> > If DateDiff("d",rstblAYPStudents("HoldDate"),Now()) < 4 THEN

> >

> > I've converted the statement for SQL Server to:

> >

> > If DateDiff(d,rstblAYPStudents("HoldDate"),GetDate()) < 4 THEN

> >

> > but now get the error message "Invalid procedure call or argument:

> > 'DateDiff'"

> >

> > Am I coding this wrong?

> >

> > Steve

> >

> >



--- 

FREE SOFTWARE DEVELOPMENT CODE, CONTENT, AND

INSIGHTS IN YOUR INBOX!

Get the latest and best C++, Visual C++, Java, Visual Basic, and XML tips, tools, and 

developments from the experts.  Sign up for one or more of EarthWeb?s

FREE IT newsletters at http://www.earthweb.com today!  

---

You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com

Message #6 by "Ken Schaefer" <ken@a...> on Wed, 20 Dec 2000 10:35:41 +1100
In ASP, you use Date(), in SQL Server you use GetDate()



Basically, it doesn't matter whether you're using an SQL Server database or

an Access database, when you write your ASP code you use the same functions.



Also, you are missing " around the d as Dallas has pointed out.



Cheers

Ken



----- Original Message -----

From: "Steve Greenstein" <stevegrn@s...>

To: "ASP Databases" <asp_databases@p...>

Sent: Tuesday, December 19, 2000 1:45 PM

Subject: [asp_databases] Re: DateDiff Differences - Access vs SQL





> ASP. Here's the whole section of code:

>

> If (DateDiff("d",(rstblAYPStudents("HoldDate")),(Now())) < 4) THEN

>    Response.Write "<TD BACKGROUND='graphics/bluechalk.jpg'

> ALIGN='CENTER'><FONT FACE='Arial, Helvetica' SIZE='1'

COLOR='#FF0000'><B>On

> Hold</B></FONT></TD>"

>    ELSE

>    Response.Write "<TD BACKGROUND='graphics/bluechalk.jpg'

> ALIGN='CENTER'> </TD>"

>   End If

>

> Steve

>







--- 

FREE SOFTWARE DEVELOPMENT CODE, CONTENT, AND

INSIGHTS IN YOUR INBOX!

Get the latest and best C++, Visual C++, Java, Visual Basic, and XML tips, tools, and 

developments from the experts.  Sign up for one or more of EarthWeb?s

FREE IT newsletters at http://www.earthweb.com today!  

---

You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com

Message #7 by "Dallas Martin" <dmartin@z...> on Tue, 19 Dec 2000 20:51:48 -0500
getdate() is a SQL function, not an VBScript function.



Since this is ASP code, try this



If DateDiff("d",rstblAYPStudents("HoldDate"),now()) < 4 Then



DM





----- Original Message -----

From: "Steve Greenstein" <stevegrn@s...>

To: "ASP Databases" <asp_databases@p...>

Sent: Tuesday, December 19, 2000 12:02 PM

Subject: [asp_databases] Re: DateDiff Differences - Access vs SQL





> Thanks Dallas, but, unfortunately, this was one of the first things I

tried.

> That would make the statement:

>

> If DateDiff("d",rstblAYPStudents("HoldDate"),getdate()) <4 Then

>

> But, it doesn't work. I get this error message:

> Microsoft VBScript runtime error '800a000d'

> Type mismatch: 'getdate'

> chi/inboundSQLServer/inbound2.asp, line 179

>

> Thanks,

> Steve





---

FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS

IN YOUR INBOX!

Get the latest and best HTML, XML, and JavaScript tips, tools, and 

developments from the experts.  Sign up for one or more of EarthWeb's

FREE IT newsletters at http://www.earthweb.com today!  

---

You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com


  Return to Index