有谁看过“李维的新书《Delphi7高效数据库程序设计》”没有??在下刚学Delphi7,照着李维这本书做到 2.1.1这一节 使用动态SQL语句处理数据 做到步骤四即执行范例应用程序,运行不了。错误提示如下:“Project Project2.exe raised exception class EDatabaseError with message 'SQLState:42S22',SQL Error Code:207',Process Use Step or Run to continue.”
不过我用的不是InterBase数据库,而是SQL Server 2000,我想这应该不影响。
在下做的代码如下:
一、UNIT1:
unit Unit1;
interface
uses
SysUtils, Types, Classes, Variants, QTypes, QGraphics, QControls, QForms,
QDialogs, QStdCtrls, QExtCtrls, QGrids, QDBGrids, QDBCtrls, DB;
type
TForm1 = class(TForm)
BOOKIM: TDataSource;
DBNavigator1: TDBNavigator;
DBGrid1: TDBGrid;
Panel1: TPanel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Publi: TDataSource;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.xfm}
end.
二 、UNIT2:
unit Unit2;
interface
uses
SysUtils, Classes, QTypes, DBXpress, DB, DBClient, SimpleDS, SqlExpr;
type
TDataModule2 = class(TDataModule)
SsccnDemo: TSQLConnection;
BOOKIM: TSimpleDataSet;
Publi: TSimpleDataSet;
procedure BOOKIMAfterScroll(DataSet: TDataSet);
private
{ Private declarations }
public
{ Public declarations }
end;
var
DataModule2: TDataModule2;
implementation
{$R *.xfm}
procedure TDataModule2.BOOKIMAfterScroll(DataSet: TDataSet);
begin
try
Self.Publi.Active:=False;
Self.Publi.Dataset.Params.ParamByName('ISDN').Value:=
Self.BOOKIM.FieldByName('ISDN').Value;
Self.Publi.Active:=True;---->,运行时提示以上错误,确定后这一行有绿箭头指示。
except
On Exception do;
end;
end;
end.
请高手帮看看错在哪?如果这一步都不通过真打击信心,估计以后再也跟编程无缘了,谢谢帮忙!
[此贴子已经被作者于2006-4-29 1:29:39编辑过]