Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Posts
    21

    Unanswered: No value given for one or more required parameters.

    I've used the same sql statement with SQL SERVER and it works fine but get the error above with Access

    Here's the sql statement
    --------------------------------------------------------------
    string sSQL = "SELECT appointId FROM appointment WHERE ((@EndDate > appointDate) AND (@EndDate < appointDateTimeEnd) AND (patientId = @patientId) OR ((@StartDate > appointDate) AND (@StartDate < appointDateTimeEnd) AND (patientId = @patientId) OR ((@StartDate <= appointDate) AND (@EndDate >= appointDateTimeEnd) AND (patientId = @patientId)) ORDER BY appointDateTime ASC";

    OleDbCommand cCommand = new OleDbCommand(sSQL);
    cCommand.Parameters.Add("@EndDate", OleDbType.Date).Value = EndDate.ToString();
    cCommand.Parameters.Add("@StartDate", OleDbType.Date).Value = StartDate.ToString();
    cCommand.Parameters.Add("@patientId", OleDbType.Numeric).Value = patientId;
    ----------------------------------------------------------------

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: No value given for one or more required parameters.

    Originally posted by pt2004
    I've used the same sql statement with SQL SERVER and it works fine but get the error above with Access

    Here's the sql statement
    --------------------------------------------------------------
    string sSQL = "SELECT appointId FROM appointment WHERE ((@EndDate > appointDate) AND (@EndDate < appointDateTimeEnd) AND (patientId = @patientId) OR ((@StartDate > appointDate) AND (@StartDate < appointDateTimeEnd) AND (patientId = @patientId) OR ((@StartDate <= appointDate) AND (@EndDate >= appointDateTimeEnd) AND (patientId = @patientId)) ORDER BY appointDateTime ASC";

    OleDbCommand cCommand = new OleDbCommand(sSQL);
    cCommand.Parameters.Add("@EndDate", OleDbType.Date).Value = EndDate.ToString();
    cCommand.Parameters.Add("@StartDate", OleDbType.Date).Value = StartDate.ToString();
    cCommand.Parameters.Add("@patientId", OleDbType.Numeric).Value = patientId;
    ----------------------------------------------------------------
    You have mismatched parens ... Verify your logic.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •