Wrox Programmer Forums
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 27th, 2006, 03:59 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jmss66
Default Select Statement

What is the syntax for a select statement with date?

I have the following select statement and I am getting a syntax error. The database is Oracle 8.i

mysql = "SELECT * FROM dbo.Member_Custom_Acct where Member_ID = " & rsActive("Member_ID") '& " AND Date_01 < '01/01/2006'"

I am trying to get all records that has a date older than 01/01/2006.

Thanks


 
Old February 27th, 2006, 06:50 PM
Wrox Technical Editor
 
Join Date: Dec 2005
Posts: 271
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try the ISO standard date format: YYYY-MM-DD H24:MI:SS

- A.Kahtava
 
Old March 10th, 2006, 05:43 PM
Authorized User
 
Join Date: Nov 2005
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

did u sort it

 
Old March 13th, 2006, 03:55 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

the problem is a wrong VB syntax, not in the select statement. If that was a case, you should have got a database error when running the code.

There is a ' sign before the last & that needs to be removed :

'& " AND Date_01 < '01/01/2006'"

I would write like this, enclosing rsActive within ''

mysql = _
"SELECT * FROM dbo.Member_Custom_Acct where Member_ID = '" & _
rsActive("Member_ID") & _
"' AND Date_01 < '01/01/2006'"

Marco





Similar Threads
Thread Thread Starter Forum Replies Last Post
select statement ??? RinoDM SQL Server 2000 7 June 19th, 2008 08:40 AM
select Statement gregalb SQL Server 2000 3 January 15th, 2008 12:00 AM
select statement help... RinoDM SQL Server 2000 13 January 10th, 2008 08:34 PM
Select from another select statement to a repeater simsen ASP.NET 2.0 Professional 0 May 2nd, 2007 04:34 PM
Select Statement jmss66 Oracle 1 May 27th, 2004 02:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.