Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2002
    Posts
    4

    Question Unanswered: Problem with ADO and MSSQL

    We have just changed all of our DB functionality from the BDE with the standard component query to ADO with the ADOquery. The follow doesn’t work anymore now :

    qRooms->Close();
    qRooms->SQL->Clear();
    qRooms->SQL->Add("Select * from Billeting where (SDATE >=:startdate and");
    qRooms->SQL->Add("SDATE <=:enddate) or (EDATE >=:startdate and");
    qRooms->SQL->Add("EDATE <=:enddate) or (SDATE <:startdate and");
    qRooms->SQL->Add(" :startdate < EDATE) order by BLDG");
    qRooms->Parameters->ParamByName("startdate")->Value = StrToDate(VOQDate);
    qRooms->Parameters->ParamByName("enddate")->Value = (StrToDate(VOQDate) + 14);
    qRooms->Open();

    Why doesn’t this work? What am I doing wrong?

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    What programming environment are you using ?

  3. #3
    Join Date
    Dec 2002
    Posts
    4
    Borland C++ Builder 6

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    I am not familiar with bc++ 6 builder - but does it matter that no spaces exist between the 1st and 3rd add methods (I put # where a space was lacking) ?

    qRooms->SQL->Add("Select * from Billeting where (SDATE >=:startdate and #");
    qRooms->SQL->Add("# SDATE <=:enddate) or (EDATE >=:startdate and #");
    qRooms->SQL->Add("# EDATE <=:enddate) or (SDATE <:startdate and");

  5. #5
    Join Date
    Nov 2002
    Location
    South Africa
    Posts
    9

    Re: Problem with ADO and MSSQL

    What error are you getting?

    Is it a runtime error, compile error - do you get an error at all..

    More details please.

    Stefan

  6. #6
    Join Date
    Dec 2002
    Posts
    4
    No errors, I just don't get all the data back. I run that in SQL analyzer and I get all the correct data back, but in Builder I only get some of the data back.

Posting Permissions

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