Baffled and SQL

mazey vorstagg

mazey vorstagg

Wilds Pathfinder

Join Date: Aug 2006

Nodnol

Meeting of Lost Minds

E/Mo

Firstly, I'll say this is most likely the completely wrong place and even the completely wrong forum. However, I'm stuck.

If you can point me to a better forum to get this question answered I'd be very grateful. There seem to be a lot of SQL forums on the internet, and all of different varieties: MS SQL, MySQL, SQL server. I don't know what any of these mean so my 'SQL forums' google search was fruitless in terms of an obvious choice.

My question:

Quote:
I'm new to working with databases and I'm trying to create a query that will select only fields that's date matches the current date.

My table (Events) contains two columns, PDate and GName.
PDate contains a Date/Time and GName is text .

Currently my query looks like

Code:
SELECT       GName
FROM         Events
WHERE        PDate = DateTime.Today
I know that DateTime.Today isn't an SQL method, and it doesn't work currently (it just sees it as a parameter) but it works in Vb.net so I've put it there as a placeholder. If I run this in Access I get a message box asking me to fill in a value for the parameter DateTime.Today and when I fill it (with a date that is in my table) it returns the correct GName. The problem is, this needs to be automatic as I'm going to be calling this query through a VB.net application. So, how do I get SQL to read DateTime.Today (or something similar) from the system clock like VB does?

Thankyou very much
Mazey
So, can anyone help me out here? Either by answering my question or by pointing me to a forum where I'll get the answers I seek?

Thanks again

Mazey

I pwnd U

I pwnd U

God of Spammers

Join Date: Oct 2005

in the middle of a burning cornfield...

Scars Meadows [SMS] (Officer)

Might wanna try the Tech Corner. They are better at figuring out computer related stuff then us poor Off-topicer's.

mazey vorstagg

mazey vorstagg

Wilds Pathfinder

Join Date: Aug 2006

Nodnol

Meeting of Lost Minds

E/Mo

Ok. If I don't get answer here by tomorrow morning I'll repost.

Just don't want to double post needlessly

zwei2stein

zwei2stein

Grotto Attendant

Join Date: Jun 2006

Europe

The German Order [GER]

N/

Pretty much every SQL dialect has "Current Date" symbol. Did you try googling for access one?

If it fails, you can have your application simply supply date by inserting it there, duh, simple string operation.

...ERE PDate = '" + formatDateForSQL(DateTime.Today) + "'"

FormatForSQL is your function that prepares date string.

Elder III

Elder III

Furnace Stoker

Join Date: Jan 2007

Ohio

I Will Never Join Your Guild (NTY)

R/

start here:

http://en.wikipedia.org/wiki/SQL