We are using SDAC (8.0.3) component with C++ Builder 6.
I've created simple test application that contains TMSConnection and TMSQuery.
I've only changed these properties of TMSQuery.
TMSQuery->FetchAll = false
TMSQuery->Options->NonBlocking = true
TMSQuery->Options->QueryRecCount = true
Here is table and there is 10 rows. (SQL Server 2012)
Code: Select all
USE [TEST]
GO
/****** Object: Table [dbo].[TEST] Script Date: 24-7-2018 15:48:46 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TEST](
[ID] [int] IDENTITY(1,1) NOT NULL,
[FNAME] [varchar](10) NULL,
CONSTRAINT [PK_TEST] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
Code: Select all
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "DBAccess.hpp"
#include "MemDS.hpp"
#include "MSAccess.hpp"
#include <DB.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TMSConnection *MSConnection1;
TMSQuery *MSQuery1;
TButton *btnOpen;
TButton *btnClose;
TButton *btnLast;
void __fastcall btnCloseClick(TObject *Sender);
void __fastcall btnOpenClick(TObject *Sender);
void __fastcall btnLastClick(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
Code: Select all
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "DBAccess"
#pragma link "MemDS"
#pragma link "MSAccess"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btnCloseClick(TObject *Sender)
{
MSQuery1->Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btnOpenClick(TObject *Sender)
{
MSQuery1->SQL->Text = "SELECT * FROM TEST";
MSQuery1->Open();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btnLastClick(TObject *Sender)
{
MSQuery1->Last();
}
//---------------------------------------------------------------------------
Step 1 : Click To button btnOpenClick.
Step 2: Click To button btnLastClick
Step 3: Click To Button btnCloseClick.
Application is blocking after clicking the btnCloseClick.
How to fix this problem ?
Thanks for support.