J
jadesun
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure Tguestbook.LinkDatabase;
var DB_Path:string;
begin
DB_Path := ExtractFilePath (ParamStr(0))+'database.mdb';
DB_Path := 'Provider=Microsoft.Jet.OLEDB.4.0;Password="";User ID=;Data Source='+DB_Path+';Persist Security Info=False';
conn := CreateOleObject('ADODB.Connection');
conn.CursorLocation := aduseclient;
conn.open(DB_Path);
end;
procedure Tguestbook.SaveArticle;
var fatherid:integer;
subject,body:String;
addposttime:TDatetime;
sql:String;
begin
fatherid := request.form.Item ['fatherid'];
subject := request.Form.Item ['subject'];
body := request.Form.Item ['body'];
addposttime:=now;
sql := 'Insert into [guestbook] (fatherid,subject,body,addposttime) values ('+IntToStr(fatherid)+','''+subject+''','''+body+''','''+DatetimeToStr(addposttime)+''')';
conn.execute(sql);
end;
ASP中:
<%
Dim DelphiASPObj
Set DelphiASPObj = Server.CreateObject("Project2.guestbook")
DelphiASPObj.LinkDatabase()
DelphiASPObj.SaveArticle()
Set DelphiASPObj = Nothing
%>
执行后,出现错误提示:
Project2.guestbook 错误 '80004005'
操作必须使用一个可更新的查询。
/dispbbs.asp,行5
???
var DB_Path:string;
begin
DB_Path := ExtractFilePath (ParamStr(0))+'database.mdb';
DB_Path := 'Provider=Microsoft.Jet.OLEDB.4.0;Password="";User ID=;Data Source='+DB_Path+';Persist Security Info=False';
conn := CreateOleObject('ADODB.Connection');
conn.CursorLocation := aduseclient;
conn.open(DB_Path);
end;
procedure Tguestbook.SaveArticle;
var fatherid:integer;
subject,body:String;
addposttime:TDatetime;
sql:String;
begin
fatherid := request.form.Item ['fatherid'];
subject := request.Form.Item ['subject'];
body := request.Form.Item ['body'];
addposttime:=now;
sql := 'Insert into [guestbook] (fatherid,subject,body,addposttime) values ('+IntToStr(fatherid)+','''+subject+''','''+body+''','''+DatetimeToStr(addposttime)+''')';
conn.execute(sql);
end;
ASP中:
<%
Dim DelphiASPObj
Set DelphiASPObj = Server.CreateObject("Project2.guestbook")
DelphiASPObj.LinkDatabase()
DelphiASPObj.SaveArticle()
Set DelphiASPObj = Nothing
%>
执行后,出现错误提示:
Project2.guestbook 错误 '80004005'
操作必须使用一个可更新的查询。
/dispbbs.asp,行5
???