Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. [Message Deleted]

[Message Deleted]

Scheduled Pinned Locked Moved ASP.NET
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mjc225
    wrote on last edited by
    #1

    [Message Deleted]

    C 1 Reply Last reply
    0
    • M mjc225

      [Message Deleted]

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups