J
jadesun
Unregistered / Unconfirmed
GUEST, unregistred user!
只要文章中同时存在":两个符号在同一行中,就会出错
添加的代码如下:
procedure TForm1.Button1Click(Sender: TObject);
Var
s:String;
begin
s:=Memo1.Lines.Text;
If edit1.Text = '' Then
Begin
ShowMessage('错误:你必须填写文章标题');
Exit;
End;
AdoQuery1.Close;
AdoQuery1.SQL.Clear ;
AdoQuery1.SQL.Add('Select Text_Title From Text_data Where Text_Title = '''+Edit1.Text+'''');
Try
AdoQuery1.Open;
Except
Exit;
End;
If Not AdoQuery1.Eof Then
Begin
ShowMessage('错误:这个标题已经存在');
Exit;
End;
AdoQuery1.Close;
AdoQuery1.SQL.Clear ;
AdoQuery1.SQL.Add('Insert into Text_Data (Text_Title,Text_Content) values ('''+Edit1.Text+''','''+StringReplace(s,'''','**',[rfReplaceAll])+''')');
Try
AdoQuery1.ExecSQL;
Except
on e:exception do
ShowMessage(''+e.Message+'');
End;
ShowMessage('成功的添加了此文章');
TwoNode := TreeView1.Items.AddChild(OneNode,''+Edit1.Text+'');
end;
添加的代码如下:
procedure TForm1.Button1Click(Sender: TObject);
Var
s:String;
begin
s:=Memo1.Lines.Text;
If edit1.Text = '' Then
Begin
ShowMessage('错误:你必须填写文章标题');
Exit;
End;
AdoQuery1.Close;
AdoQuery1.SQL.Clear ;
AdoQuery1.SQL.Add('Select Text_Title From Text_data Where Text_Title = '''+Edit1.Text+'''');
Try
AdoQuery1.Open;
Except
Exit;
End;
If Not AdoQuery1.Eof Then
Begin
ShowMessage('错误:这个标题已经存在');
Exit;
End;
AdoQuery1.Close;
AdoQuery1.SQL.Clear ;
AdoQuery1.SQL.Add('Insert into Text_Data (Text_Title,Text_Content) values ('''+Edit1.Text+''','''+StringReplace(s,'''','**',[rfReplaceAll])+''')');
Try
AdoQuery1.ExecSQL;
Except
on e:exception do
ShowMessage(''+e.Message+'');
End;
ShowMessage('成功的添加了此文章');
TwoNode := TreeView1.Items.AddChild(OneNode,''+Edit1.Text+'');
end;