Geekzone: technology news, blogs, forums
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.

1371 posts

Uber Geek

# 70013 16-Oct-2010 14:44
Send private message

Ok so i am making a program in visual basic express 2010, and i have it hooked upto a database made in access 2007.

I run a query on the database like "SELECT * FROM myTable WHERE myDate=#08/10/2010#"

this should work fine as i have checked my database and the dates in their afre in nz date format and their are three rows in the database with this date but my query returns nothing.

So i thought i would change my query to use american dates, so my query is now like this:

"SELECT * FROM myTable WHERE myDate=#10/08/2010#"

and for some strange reason this works even though it shouldn't.

Anyway i thought sweet i will just use american dates and it will be fine - turns out i was wrong, as soon as the date goes over the 12th day it error so when the query is like this:

"SELECT * FROM myTable WHERE myDate=#10/13/2010#"

it has an overloaded date error in visual basic.

I have no idea what i have done wrong here but any help would be fantastic as this has been frustrating me for days.


Create new topic
Phil Gale
1108 posts

Uber Geek

Red Jungle

  # 392613 16-Oct-2010 14:46
Send private message

It's been a loooong time since I've worked with an Access DB.. but try using the format yyyy-mm-dd.

Red Jungle: we make fantastic software

RSS  Twitter  Facebook  Skype

134 posts

Master Geek

  # 392616 16-Oct-2010 14:57
Send private message

RedJungle is correct - use the yyyy-mm-dd format. This should cover you off.

Also - it's probably a good idea to make sure the machine running IIS (either your development machine or your server) is setup to use NZ regional settings - as this can cause confusion if not set properly.

So - when you're inserting, or selecting - use the above format and you should be aok. 


1371 posts

Uber Geek

  # 392648 16-Oct-2010 17:40
Send private message

OK cheers thanks very much guys i will give that ago when i got home.

Before i started this project i did check the regional settings and they were set to american for some strange reason.

Thanks again :)

Phil Gale
1108 posts

Uber Geek

Red Jungle

  # 392652 16-Oct-2010 17:50
Send private message

The other (better) option would be to move towards parameterised queries. So rather than passing in a formatted date string for your query, you would be able to use an actual DateTime object. Much easier, and much safer from a SQL Injection point of view.

Red Jungle: we make fantastic software

RSS  Twitter  Facebook  Skype

Create new topic

Twitter and LinkedIn »

Follow us to receive Twitter updates when new discussions are posted in our forums:

Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:

Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:

News »

Arlo unveils its first video doorbell
Posted 21-Oct-2019 08:27

New Zealand students shortlisted for James Dyson Award
Posted 21-Oct-2019 08:18

Norton LifeLock Launches Norton 360
Posted 21-Oct-2019 08:11

Microsoft New Zealand Partner Awards results
Posted 18-Oct-2019 10:18

Logitech introduces new Made for Google keyboard and mouse devices
Posted 16-Oct-2019 13:36

MATTR launches to accelerate decentralised identity
Posted 16-Oct-2019 10:28

Vodafone X-Squad powers up for customers
Posted 16-Oct-2019 08:15

D Link ANZ launches EXO Smart Mesh Wi Fi Routers with McAfee protection
Posted 15-Oct-2019 11:31

Major Japanese retailer partners with smart New Zealand technology IMAGR
Posted 14-Oct-2019 10:29

Ola pioneers one-time passcode feature to fight rideshare fraud
Posted 14-Oct-2019 10:24

Spark Sport new home of NZC matches from 2020
Posted 10-Oct-2019 09:59

Meet Nola, Noel Leeming's new digital employee
Posted 4-Oct-2019 08:07

Registrations for Sprout Accelerator open for 2020 season
Posted 4-Oct-2019 08:02

Teletrac Navman welcomes AI tech leader Jens Meggers as new President
Posted 4-Oct-2019 07:41

Vodafone makes voice of 4G (VoLTE) official
Posted 4-Oct-2019 07:36

Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.

Support Geekzone »

Our community of supporters help make Geekzone possible. Click the button below to join them.

Support Geezone on PressPatron

Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.