L
lzh1974
Unregistered / Unconfirmed
GUEST, unregistred user!
我在dll中使用ado控件连接数据库,但在数据库插入数据时出错,源代码如下
unit htmlsave;
interface
uses
ComObj, ActiveX, html_save_TLB, StdVcl;
type
Tweb_save = class(TAutoObject, Iweb_save)
protected
procedure get_html(const title, location, html: WideString;
type_id: Shortint)
safecall;
private
procedure getftp(const title, location, remark: WideString);
procedure gethttp(const title, location, remark: WideString);
procedure getdocument(const title, location, html: WideString);
{ Protected declarations }
end;
implementation
uses ComServ,unit3,Sysutils,dialogs,ADODB;
const Is_html=1;
Is_tcp=2;
Is_ftp=12;
Is_http=11;
procedure Tweb_save.getdocument(const title, location, html: WideString);
begin
with TADOTable.create(nil) do begin
TableName:='test.db';
ConnectionString:='Provider=MSDASQL.1;Persist Security Info=False;Data Source=paradox 5.0;Mode=Read|Write;Initial Catalog=C:/temp/01';
open;
insert;
fieldbyname('title').asstring:=title;
fieldbyname('location').asstring:=location;
fieldbyname('htmldoc').asstring:=html
fieldbyname('Date_time').asdatetime:=date();
fieldbyname('depth').asinteger:=1;
fieldbyname('parent').asinteger:=0;
fieldbyname('type').asinteger:=Is_html;
fieldbyname('Remark').asstring:='';
post;
close;
free;
end;
end;
程序中如果把插入数据部分去掉则不会出问题,如果有知道的朋友,请告知原因
unit htmlsave;
interface
uses
ComObj, ActiveX, html_save_TLB, StdVcl;
type
Tweb_save = class(TAutoObject, Iweb_save)
protected
procedure get_html(const title, location, html: WideString;
type_id: Shortint)
safecall;
private
procedure getftp(const title, location, remark: WideString);
procedure gethttp(const title, location, remark: WideString);
procedure getdocument(const title, location, html: WideString);
{ Protected declarations }
end;
implementation
uses ComServ,unit3,Sysutils,dialogs,ADODB;
const Is_html=1;
Is_tcp=2;
Is_ftp=12;
Is_http=11;
procedure Tweb_save.getdocument(const title, location, html: WideString);
begin
with TADOTable.create(nil) do begin
TableName:='test.db';
ConnectionString:='Provider=MSDASQL.1;Persist Security Info=False;Data Source=paradox 5.0;Mode=Read|Write;Initial Catalog=C:/temp/01';
open;
insert;
fieldbyname('title').asstring:=title;
fieldbyname('location').asstring:=location;
fieldbyname('htmldoc').asstring:=html
fieldbyname('Date_time').asdatetime:=date();
fieldbyname('depth').asinteger:=1;
fieldbyname('parent').asinteger:=0;
fieldbyname('type').asinteger:=Is_html;
fieldbyname('Remark').asstring:='';
post;
close;
free;
end;
end;
程序中如果把插入数据部分去掉则不会出问题,如果有知道的朋友,请告知原因