|
| » 首页 » 电脑_数码 » 编程 » 我的Delphi学生管理系统在检测的时候没问题,但是在运行... |
我的Delphi学生管理系统在检测的时候没问题,但是在运行... |
|
project project1.exe raised exception class EOleException with message 'FROM 子句语法错误。'. process stopped. use step or run to continue. 我把我的查询信息代码发下:(麻烦大家看看哪里有错误。谢谢哦。) unit FView; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, DBCtrls, Grids, DBGrids, DB, ComCtrls, ADODB; 治疗省略那些。。(字数太多发不了问题=。=) var FView1: TFView1; implementation {$R *.dfm} uses FMain; procedure TFView1.FormClose(Sender: TObject; var Action: TCloseAction); begin Action := caFree; end; procedure TFView1.SpeedButton1Click(Sender: TObject); begin listbox1.Items.Add(DBLookuplistbox1.selectedItem); end; procedure TFView1.SpeedButton2DblClick(Sender: TObject); begin listbox1.items.Delete(listbox1.ItemIndex); end; procedure TFView1.BitBtn1Click(Sender: TObject); var n,i:integer; sqlstr:string; begin sqlstr:='SELECT * FROM stuinfo'; n:=listbox1.Items.Count - 1; if n>=0 then begin sqlstr:=sqlstr+'WHERE(省份='''+listbox1.Items[0]+''')'; i:=1; while i<n do begin sqlstr:=sqlstr+'OR(省份='''+listbox1.Items[i]+''')'; i:=i+1; end; end; sqlstr:=sqlstr+';'; memo1.Lines.add(sqlstr); ADOQuery1.SQL.Clear; ADOQuery1.SQL.Add(sqlstr); ADOQuery1.Open; end; procedure TFView1.DBLookupListBox3Click(Sender: TObject); begin edit1.Text:=DBLookuplistbox2.SelectedItem; end; procedure TFView1.DBLookupListBox2Click(Sender: TObject); begin edit2.Text:=DBLookuplistbox3.SelectedItem; end; procedure TFView1.BitBtn2Click(Sender: TObject); var sqlstr:string; begin sqlstr:='SELECT * FROM stuinfo'; if (edit1.Text='') and (edit2.Text='') then begin sqlstr:=sqlstr+';'; if combobox1.Text<>'' then combobox1.Text:=''; end; if (edit1.Text<>'')and(edit2.Text<>'') then begin if combobox1.Text='' then combobox1.Text:='or'; sqlstr:=sqlstr+'WHERE 省份 LIKE ''%'+edit1.Text+'%'''; sqlstr:=sqlstr+' '+combobox1.Text; sqlstr:=sqlstr+' 姓名 LIKE ''%'+edit2.Text+'%'';'; end; if (edit1.Text<>'')and(edit2.Text='') then begin if combobox1.Text<>'' then combobox1.Text:=''; sqlstr:=sqlstr+'WHERE 省份 LIKE ''%'+edit1.Text+'%'';'; end; if (edit1.Text='')and(edit2.Text<>'') then begin if combobox1.Text<>'' then combobox1.Text:=''; sqlstr:=sqlstr+' WHERE 姓名 LIKE ''%'+edit2.Text+'%'';'; end; memo1.Lines.Add(sqlstr); ADOQuery1.SQL.clear; ADOQuery1.SQL.add(sqlstr); ADOQuery1.Open; end; end. |
![]() |
|
|
|
| 《我的Delphi学生管理系统在检测的时候没问题,但是在运行...》答案收集时间:2008-06-14 14:28:21 |