我做了李维的ADO/MTS/COM+中的那个第三章最后一个例子(ADO And Web Broker)为什么....(200分)

  • 主题发起人 主题发起人 瑞雪
  • 开始时间 开始时间

瑞雪

Unregistered / Unconfirmed
GUEST, unregistred user!
我用写入文件的方法发现那个TPageProducer的OnHTMLTag事件根本不被触发!
属性什么的都没有错,我已经做了n遍了,你们帮帮我吧!

unit ADOWebUnt;

interface

uses
SysUtils, Classes, HTTPApp, DB, ADODB, DBWeb, HTTPProd;

type
TWebModule1 = class(TWebModule)
ADOConnection1: TADOConnection;
DataSetTableProducer1: TDataSetTableProducer;
ADOTable1: TADOTable;
ADOTable1ID: TIntegerField;
ADOTable1Ready_Money: TBCDField;
ADOTable1Total_Money: TBCDField;
ADOTable1Last_Act_Date: TDateTimeField;
ADOTable1Decription: TMemoField;
ADOTable1State: TBooleanField;
ADOTable1Name: TWideStringField;
ADOTable1Tel_fr: TLargeintField;
ADOTable1Tel_se: TLargeintField;
ADOTable1Addr: TWideStringField;
ADOTable1Sex: TBooleanField;
ADOTable1Machine_Type: TBooleanField;
ADOTable1OrderFile: TBlobField;
ADOTable1BuyBook: TBooleanField;
PageProducer1: TPageProducer;
procedure DataSetTableProducer1FormatCell(Sender: TObject; CellRow,
CellColumn: Integer; var BgColor: THTMLBgColor;
var Align: THTMLAlign; var VAlign: THTMLVAlign; var CustomAttrs,
CellData: String);
procedure PageProducer1HTMLTag(Sender: TObject; Tag: TTag;
const TagString: String; TagParams: TStrings;
var ReplaceText: String);
private
{ Private declarations }
public
{ Public declarations }
end;

var
WebModule1: TWebModule1;

implementation

{$R *.DFM}

procedure TWebModule1.DataSetTableProducer1FormatCell(Sender: TObject;
CellRow, CellColumn: Integer; var BgColor: THTMLBgColor;
var Align: THTMLAlign; var VAlign: THTMLVAlign; var CustomAttrs,
CellData: String);
var
DataSet: TDataSet;
begin
if CellRow <> 0 then
if CellColumn = 0 then
begin
DataSet:= (Sender as TDataSetTableProducer).DataSet;
CellData:= CellData + '<input type="checkbox" name="ISBN"' + DataSet.FieldByName('ID').AsString;
CellData:= CellData + '>';
end;
end;

procedure TWebModule1.PageProducer1HTMLTag(Sender: TObject; Tag: TTag;
const TagString: String; TagParams: TStrings; var ReplaceText: String);
begin
if TagString = 'BooksTag' then ReplaceText:= DataSetTableProducer1.Content;
end;
end.

以下是那个HTML样板的代码!

<html>

<head>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<meta name="Generator" content="Microsoft Word 10">
<title>ADO WebBroker 范例应用程序</title>
</head>

<body bgcolor="#FFFFFFF">

<form method="post">
<p align="center"><font color="#0000FF" size="6">ADO WebBroker 范例应用程序</p>
<p align="center">#BooksTag</p>
<p align="center"><input type="submit" name="btnBuy" value="确认"><input type="reset" name="btnBuy" value="提消"></p>
</form>

</body>

</html>



至于组件的属性我都是按书上填的!
 
好像在html模板中的标记要扩起来的,像这样<#BooksTag>
 
接受答案了.
 
后退
顶部