Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: converting text to date and date to text


Message #1 by jacobs35@m... on Tue, 30 Jan 2001 14:18:48 -0000
im trying to do somthing that i think is relativly easy, but i cant seem

to find the code that i need.



im trying to search the records in my database for workorders which are

coming due in the next week using the following code



If Request.Form("status") = "pendweek" Then

	Set WO = Server.CreateObject ("ADODB.Recordset")

	Query = "SELECT * FROM WorkOrders WHERE

Pending_due<'" & DateAdd("d",7,Date())& "'" & "ORDER BY ID"

	WO.Open Query, Connect

End IF



i am getting a data mismatch so i think i need to convert a date to text

but i cant seem to find a way to do it.



any sugestions would be greatly appreciated

Message #2 by philip.moh@a... on Wed, 31 Jan 2001 08:27:06 +0800
try to double check the SQL statement, syntax correct?



Phil



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

> From:	jacobs35@m... [SMTP:jacobs35@m...]

> Sent:	Tuesday, January 30, 2001 10:19 PM

> To:	aspx_beginners

> Subject:	[aspx_beginners] converting text to date and date to text

> 

> im trying to do somthing that i think is relativly easy, but i cant seem

> to find the code that i need.

> 

> im trying to search the records in my database for workorders which are

> coming due in the next week using the following code

> 

> If Request.Form("status") = "pendweek" Then

> 	Set WO = Server.CreateObject ("ADODB.Recordset")

> 	Query = "SELECT * FROM WorkOrders WHERE

> Pending_due<'" & DateAdd("d",7,Date())& "'" & "ORDER BY ID"

> 	WO.Open Query, Connect

> End IF

> 

> i am getting a data mismatch so i think i need to convert a date to text

> but i cant seem to find a way to do it.

> 

> any sugestions would be greatly appreciated

> 
Message #3 by "Michael Morisoli" <Michael@M...> on Tue, 30 Jan 2001 21:57:04 -0800
If you are using SQL Server, it might be the Date() function.  It should

be GetDate() instead.





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

From: philip.moh@a... [mailto:philip.moh@a...]

Sent: Tuesday, January 30, 2001 4:27 PM

To: aspx_beginners

Subject: [aspx_beginners] RE: converting text to date and date to text



try to double check the SQL statement, syntax correct?



Phil



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

> From: jacobs35@m... [SMTP:jacobs35@m...]

> Sent: Tuesday, January 30, 2001 10:19 PM

> To:   aspx_beginners

> Subject:      [aspx_beginners] converting text to date and date to

text

>

> im trying to do somthing that i think is relativly easy, but i cant

seem

> to find the code that i need.

>

> im trying to search the records in my database for workorders which

are

> coming due in the next week using the following code

>

> If Request.Form("status") =3D "pendweek" Then

>       Set WO =3D Server.CreateObject ("ADODB.Recordset")

>       Query =3D "SELECT * FROM WorkOrders WHERE

> Pending_due<'" & DateAdd("d",7,Date())& "'" & "ORDER BY ID"

>       WO.Open Query, Connect

> End IF

>

> i am getting a data mismatch so i think i need to convert a date to

text

> but i cant seem to find a way to do it.

>

> any sugestions would be greatly appreciated

>

  Return to Index