Archives

Archives / 2005 / March
  • "?" vs @param

    string sql = "SELECT COUNT(*) ";
    sql += "FROM athletes ";
    sql += "WHERE category = ? ";
    sql += "AND gender  = ? ";
     
    VS
     
    string sql = "SELECT COUNT(*) ";
    sql += "FROM athletes ";
    sql += "WHERE category = @category ";
    sql += "AND gender  = @gender ";
     
     
     

    Can I tell you how many hours I just spent on trying to get this *simple* query to work in Access via ADO.NET?  What is up with the "?" as parameters?  What happend to @param format like the SqlClient?  Why do they work in the Access Querybuilder itself, but not using ADO.NET?  Maybe I'm approaching this wrong.