Stored procedures and MS-SQL

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
PiSymbol
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 10.04.2006, 19:22

Stored procedures and MS-SQL

Post by PiSymbol »

Dear Visitors,

I'm using C++ Builder 6.0 Enterprise and Zeos DBO v6.5.1 alpha. I'm trying to retreive the result of an stored procedure of a MS-SQL database.

The following code doesn't work properly: (The result is empty)

Code: Select all

MS-SQL Query: 
  exec test (test contains three times a 'select')

C++ source:
  ZConnection1->Connect();
  if(ZConnection1->Connected)
        {
          ZQuery1->Close();
          ZQuery1->SQL->Clear();
          ZQuery1->SQL->Text = queryMemo->Text.Trim();
          ZQuery1->Close();
          ZQuery1->Open();
          ZQuery1->FindFirst();

          while(ZQuery1->Eof == false)
                {
                  for(int i=1; i<ZQuery1->FieldDefList->Count + 1; i++)
                        {
                          resultMemo->Lines->Add(ZQuery1->Fields->FieldByNumber(i)->AsString);
                        }
                  ZQuery1->Next();
                }
          ZQuery1->Close();
          ZConnection1->Disconnect();
        }
Could someone please explain what's wrong? Do I need to use 'ZStoreProc' instead of 'ZQuery'?

Thanks in advance for your help!

Ps. The Stored Procedure works properly in other applications
PiSymbol
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 10.04.2006, 19:22

Post by PiSymbol »

Could someone explain how I can use 'Stored Procedures'?

Thanks!
Post Reply