本人只是个初学者,在做一简单的房产信息租赁系统,有两个小问题,希望大家能帮我解决下!谢谢!~问题一:运行登陆界面时,输入用户名,按回车到密码框,输完密码却需要按两次回车才能登陆。
我自己写的代码如下:
procedure TloginForm.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=vk_return then
edit2.SetFocus;
end;
procedure TloginForm.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
button1.SetFocus;
end;问题二:在做查询页面时,在查询条件中下拉“面积”,“>=”,输入“90”,然后直接点查询,出现报错“工程houseManager.exe检测到错误类。EDBEngine Error,错误信息:'Type mismatch in expression'.”进程中止!
搜索其他条件均能正常运行,是不是因为fwgl数据库里,面积选项是N,所以,搜索的话,需要再加代码?请问怎样修改就能运行了呢?
我自己写的代码如下:
procedure TloginForm.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=vk_return then
edit2.SetFocus;
end;
procedure TloginForm.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
button1.SetFocus;
end;问题二:在做查询页面时,在查询条件中下拉“面积”,“>=”,输入“90”,然后直接点查询,出现报错“工程houseManager.exe检测到错误类。EDBEngine Error,错误信息:'Type mismatch in expression'.”进程中止!
搜索其他条件均能正常运行,是不是因为fwgl数据库里,面积选项是N,所以,搜索的话,需要再加代码?请问怎样修改就能运行了呢?
procedure TloginForm.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
button1.Click;
end;
begin
if key=#13 then
button1.SetFocus;// 这一句改成执行button1的代码
end;2、检查一下数据类型是否正确
我就不知道数据类型哪儿错了,系统的提示,我也懂,就是不懂错哪儿了
procedure Thouseform_vi.checkbox1click(Sender: TObject);
begin
if CheckBox1.Checked=True then
begin
with Query1 do
begin
Close;
SQL.Clear;
SQL.Add('select * from house');
Open;
end;
DataSource1.DataSet:=Query1;
end;
end;procedure Thouseform_vi.BitBtn1Click(Sender: TObject);
var
operator:string;
begin
if (Trim(ComboBox1.Text)='') or (Trim(ComboBox2.Text)='') or (Trim(edit1.Text)='') then
showmessage('请输入完整的查询条件')
else
begin
case ComboBox2.itemindex of
0:operator:='>=';
1:operator:='<=';
2:operator:='=';
3:operator:='like';
4:operator:='not like';
end;
with Query1 do
begin
Close;
SQL.Clear;
SQL.Add('select * from house where');
SQL.Add(Trim(ComboBox1.Text));
SQL.Add(operator);
SQL.Add(':b');
if (ComboBox2.itemindex=3) or (ComboBox2.itemindex=4) then
ParamByName('b').value:='%'+Trim(edit1.text)+'%'
else
ParamByName('b').value:=Trim(edit1.text);
Open;
end;
if Query1.RecordCount>0 then
DataSource1.DataSet:= Query1;
end;
end;
ParamByName('b').value:='%'+Trim(edit1.text)+'%'
else
ParamByName('b').value:=Trim(edit1.text); showmessage(sql.text);//在这里Show一下SQL语句,估计是表达式各项间的空格的问题
Open;
end;
“select * from house where
面积
=
:b”
点完确定后,下一个错误信息依旧5555555~~~
You have received the following message:Project xxxx raised exception class yyyyy with message 'zzzzzz'.Process stopped. Use Step or Run to continue.This dialog box appears when a program you're debugging raises an exception, and you have set options that instruct the debugger to handle exceptions (see the Language Exceptions, OS Exceptions pages of the Tools|Debugger options dialog). Both language exceptions and operating system exceptions show this dialog. If the 'yyyyy' in the message is a class name, it indicates that the exception is a language exception. If the 'yyyyy' is a hexadecimal value, it means that the exception is an operating system exception.If the location of the exception does not correspond to a source location, a checkbox labeled "View CPU' appears in the lower left corner of the dialog box.After pressing OK on the dialog box, the IDE shows you the location where the exception occurred. If you checked the View CPU checkbox, the CPU view is displayed. If the location of the exception corresponds directly to a source location, that source location is shown (and the View CPU checkbox does not appear on the dialog box). If the exception location does not correspond to source and you do not check the View CPU checkbox, the IDE traverses the call stack looking for a call in the stack that contains source and will show you the first call found that has source.What should you do when you see this dialog?In most cases, clicking OK and doing a Run|Run to continue will work just fine. In some cases, the state of the program will prevent you from running or continuing will not allow them to continue (you will repeatedly see the exception message). In this case, you will need to choose Run|Program Reset to end the current program run and release it from memory.Type Ctrl+C to copy this or similar messages to the clipboard.
因为出来的是
“select * from house where
面积
=
:b”
同志们,怎么改啊???