2 Replies Latest reply on Nov 6, 2012 7:22 PM by 15208

    Binding SQL variables

      The following code is getting the 'Not all Variables bound' error. There are only two variables so I don't see the order being an issue. Any help would be greatly appreciated!

      Please assume the integers are assigned elsewhere.

      DateTime beginDT = new DateTime(yearInt, monthInt, dayInt, hourInt, minuteInt, secondInt);
      DateTime endDT = new DateTime(yearInt, monthInt+1, dayInt, hourInt, minuteInt, secondInt);

      SQL.Append(" WHERE DATE >= :beginDTParameter ");
      SQL.Append("AND DATE < :endDTParameter");

      OracleCommand cmd = connection.CreateCommand();
      cmd.Parameters.Add(new OracleParameter("beginDTParameter", OracleType.DateTime)).Value = beginDT;
      cmd.Parameters.Add(new OracleParameter("endDTParameter", OracleType.DateTime)).Value = endDT;