Subject | Re: [IBO] Empty error/exception message in TIBODataset |
---|---|
Author | hsdev77 |
Post date | 2006-11-06T21:28:47Z |
Hi Jason,
Thanks again for your reply.
Here is a small application with only one form (unit1.pas) using a
basic functionality of TIBOQuery.
To reproduce the error:
- Just run the app, and try connect to any database in your system by
clicking connect button (it will prompt you the details since
loginprompt is true)
- type a wrong sql text in the memo, such as
"select * from wrong_table_name;"
- click run button
below are the source code in text mode:
regards,
Hasan
//////////////////// begin of unit1.pas ///////////////
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs,
StdCtrls, ExtCtrls, Db, DBCtrls, Grids, DBGrids,
IB_Components, IBODataset;
type
TForm1 = class(TForm)
Memo1: TMemo;
Panel1: TPanel;
btnConnect: TButton;
btnRun: TButton;
DBNavigator1: TDBNavigator;
DBGrid1: TDBGrid;
Con1: TIB_Connection;
Trans1: TIB_Transaction;
Qry1: TIBOQuery;
DataSource1: TDataSource;
procedure btnConnectClick(Sender: TObject);
procedure Con1AfterConnect(Sender: TIB_Connection);
procedure Con1AfterDisconnect(Sender: TIB_Connection);
procedure btnRunClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.btnConnectClick(Sender: TObject);
begin
Con1.Connected:= not Con1.Connected;
end;
procedure TForm1.Con1AfterConnect(Sender: TIB_Connection);
begin
Caption:= 'Connected to [' + Con1.Database + '] as ' + Con1.Username;
end;
procedure TForm1.Con1AfterDisconnect(Sender: TIB_Connection);
begin
Caption:= 'Not connected';
end;
procedure TForm1.btnRunClick(Sender: TObject);
begin
if not Qry1.Active then Qry1.SQL.assign(Memo1.Lines);
case Qry1.IsSelectSQL of
True: Qry1.Active:= not Qry1.Active;
False: Qry1.ExecSQL;
end;
end;
end.
//////////////////// end of unit1.pas ///////////////
//////////////////// begin of unit1.dfm ///////////////
object Form1: TForm1
Left = 199
Top = 134
Width = 557
Height = 381
Caption = 'Not connected'
Color = clBtnFace
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Verdana'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 14
object Memo1: TMemo
Left = 0
Top = 0
Width = 549
Height = 115
Align = alTop
Lines.Strings = (
'select * from wrong_table_name;')
TabOrder = 0
end
object Panel1: TPanel
Left = 0
Top = 115
Width = 549
Height = 38
Align = alTop
BevelOuter = bvNone
TabOrder = 2
object DBNavigator1: TDBNavigator
Left = 16
Top = 8
Width = 240
Height = 25
DataSource = DataSource1
TabOrder = 0
end
object btnConnect: TButton
Left = 272
Top = 8
Width = 105
Height = 25
Caption = 'Connect to db'
TabOrder = 1
OnClick = btnConnectClick
end
object btnRun: TButton
Left = 392
Top = 8
Width = 105
Height = 25
Caption = 'Run SQL'
TabOrder = 2
OnClick = btnRunClick
end
end
object DBGrid1: TDBGrid
Left = 0
Top = 153
Width = 549
Height = 201
Align = alClient
DataSource = DataSource1
TabOrder = 1
TitleFont.Charset = ANSI_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -12
TitleFont.Name = 'Verdana'
TitleFont.Style = []
end
object Con1: TIB_Connection
LoginPrompt = True
SQLDialect = 3
Params.Strings = (
'SQL DIALECT=3')
AfterConnect = Con1AfterConnect
AfterDisconnect = Con1AfterDisconnect
Left = 12
Top = 26
end
object Trans1: TIB_Transaction
AutoCommit = True
Isolation = tiCommitted
Left = 60
Top = 26
end
object Qry1: TIBOQuery
Params = <>
IB_Connection = Con1
IB_Transaction = Trans1
RecordCountAccurate = True
RequestLive = True
FieldOptions = []
Left = 112
Top = 26
end
object DataSource1: TDataSource
DataSet = Qry1
Left = 40
Top = 188
end
end
//////////////////// end of unit1.dfm ///////////////
Thanks again for your reply.
Here is a small application with only one form (unit1.pas) using a
basic functionality of TIBOQuery.
To reproduce the error:
- Just run the app, and try connect to any database in your system by
clicking connect button (it will prompt you the details since
loginprompt is true)
- type a wrong sql text in the memo, such as
"select * from wrong_table_name;"
- click run button
below are the source code in text mode:
regards,
Hasan
//////////////////// begin of unit1.pas ///////////////
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs,
StdCtrls, ExtCtrls, Db, DBCtrls, Grids, DBGrids,
IB_Components, IBODataset;
type
TForm1 = class(TForm)
Memo1: TMemo;
Panel1: TPanel;
btnConnect: TButton;
btnRun: TButton;
DBNavigator1: TDBNavigator;
DBGrid1: TDBGrid;
Con1: TIB_Connection;
Trans1: TIB_Transaction;
Qry1: TIBOQuery;
DataSource1: TDataSource;
procedure btnConnectClick(Sender: TObject);
procedure Con1AfterConnect(Sender: TIB_Connection);
procedure Con1AfterDisconnect(Sender: TIB_Connection);
procedure btnRunClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.btnConnectClick(Sender: TObject);
begin
Con1.Connected:= not Con1.Connected;
end;
procedure TForm1.Con1AfterConnect(Sender: TIB_Connection);
begin
Caption:= 'Connected to [' + Con1.Database + '] as ' + Con1.Username;
end;
procedure TForm1.Con1AfterDisconnect(Sender: TIB_Connection);
begin
Caption:= 'Not connected';
end;
procedure TForm1.btnRunClick(Sender: TObject);
begin
if not Qry1.Active then Qry1.SQL.assign(Memo1.Lines);
case Qry1.IsSelectSQL of
True: Qry1.Active:= not Qry1.Active;
False: Qry1.ExecSQL;
end;
end;
end.
//////////////////// end of unit1.pas ///////////////
//////////////////// begin of unit1.dfm ///////////////
object Form1: TForm1
Left = 199
Top = 134
Width = 557
Height = 381
Caption = 'Not connected'
Color = clBtnFace
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Verdana'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 14
object Memo1: TMemo
Left = 0
Top = 0
Width = 549
Height = 115
Align = alTop
Lines.Strings = (
'select * from wrong_table_name;')
TabOrder = 0
end
object Panel1: TPanel
Left = 0
Top = 115
Width = 549
Height = 38
Align = alTop
BevelOuter = bvNone
TabOrder = 2
object DBNavigator1: TDBNavigator
Left = 16
Top = 8
Width = 240
Height = 25
DataSource = DataSource1
TabOrder = 0
end
object btnConnect: TButton
Left = 272
Top = 8
Width = 105
Height = 25
Caption = 'Connect to db'
TabOrder = 1
OnClick = btnConnectClick
end
object btnRun: TButton
Left = 392
Top = 8
Width = 105
Height = 25
Caption = 'Run SQL'
TabOrder = 2
OnClick = btnRunClick
end
end
object DBGrid1: TDBGrid
Left = 0
Top = 153
Width = 549
Height = 201
Align = alClient
DataSource = DataSource1
TabOrder = 1
TitleFont.Charset = ANSI_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -12
TitleFont.Name = 'Verdana'
TitleFont.Style = []
end
object Con1: TIB_Connection
LoginPrompt = True
SQLDialect = 3
Params.Strings = (
'SQL DIALECT=3')
AfterConnect = Con1AfterConnect
AfterDisconnect = Con1AfterDisconnect
Left = 12
Top = 26
end
object Trans1: TIB_Transaction
AutoCommit = True
Isolation = tiCommitted
Left = 60
Top = 26
end
object Qry1: TIBOQuery
Params = <>
IB_Connection = Con1
IB_Transaction = Trans1
RecordCountAccurate = True
RequestLive = True
FieldOptions = []
Left = 112
Top = 26
end
object DataSource1: TDataSource
DataSet = Qry1
Left = 40
Top = 188
end
end
//////////////////// end of unit1.dfm ///////////////
--- In IBObjects@yahoogroups.com, "Jason Wharton" <supportlist@...> wrote:
>
> I've added this to my list of things to check.
> If you would, send me a little sample app to be sure I'm working
with your
> problem.
>
> Jason
>