[Message Deleted]
-
mjc225 wrote:
OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM Events WHERE ([EventStartDate]>=StartDateExport) AND EventEndDate>=#12/1/2009#", cn); //This doesn't work.
Of course it doesn't. You're missing something pretty basic. When you put something in quotes, it's a literal. You're passing the word StartDateExport, instead of passing the value of the variable of the same name. OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM Events WHERE ([EventStartDate]>= " + StartDateExport + ") AND EventEndDate>=#12/1/2009#", cn); If you don't understand how to concatenate strings, I'd suggest you should work through a basic C# book before going further. Depending on where your dates come from, it's possible you will have a massive security hole in your site, due to SQL injection attacks. In any case, for you to put this in your page load is terrible design ( really, it's no design at all ). If you're teaching yourself or doing a class, it's probably fine, but if anyone is paying for this code then they are paying too much.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.