语句: 关键字 + 操作指令
----------------------------
if语句_
if 1 < 2 then
begin
Writeln('台湾第一美女');
end;
if 3 < 2 then
begin
Writeln('台湾第一美女');
end
else
begin
Writeln('你寄吧谁啊?');
end;
Readln;
-----------------------
Readln_从控制台读取一行文本,直到遇到换行符
Readln;
-------------------------------
case语句_
case i of
1 : Writeln('我是1');
2 : Writeln('我是2');
else
begin
Writeln('我是else')
end;
end;
-------------------------------------
case后面可以跟的类型:整数 字符串
------------------------------------------
登陆模块_
procedure TForm3.Button1Click(Sender: TObject);
var user : string;
var pw : string;
begin
user := edit1.text;
pw := edit2.text;
with adoquery1 do
begin
close;
sql.clear;
sql.add('SELECT * FROM Biao where Lie_1 = '+user+' And Lie_2 = '''+pw+''' ');
open;
//first;
if recordcount = 1 then
begin
showmessage('数据库连接成功');
c_ount := 1;
end
else
begin
showmessage('失败');
c_ount := 2;
end;
end;
end;
procedure TForm3.Button2Click(Sender: TObject);
var c : string;
begin
c := '1';
adoquery1.close;
adoquery1.sql.Clear;
adoquery1.sql.add('SELECT * FROM Operator where EMPLOYEECODE = '+edit1.Text+' And OperatorUsable = '''+c+''' ');
adoquery1.open;
if (adoquery1.recordcount = 1) and (c_ount = 1) then
begin
showmessage('可以打印了');
end
else
begin
showmessage('大咩打死');
end;
end;
end.
----------------------------------------
*Project7
----------------------------------
Eof = end of files
while not Eof do 判断是否结束
就是把查询出来的结果集 从第一条开始 一直执行到最后一条结束
当数据集的内容不为空时, 做begin end 内的事情
-----------------------------------
定义一个过程(java中的类和对象)_
procedure ComparingFraction(); //过程, 相当于java的类和对象
var Fraction : integer;
begin
writeln('请输入分数');
readln(Fraction);
if Fraction >= 60 then
begin
writeln('你及格了');
end;
end;
begin
comparingfraction(); //调用对象
readln;
end.
--------------------------
定义有参数的类_
procedure ComparingFraction(i:integer);
-----------------------------------
注释标准: que_ding(拼音) Class(英语)
------------------------------
if两个判断条件_
if (1 < 3) and (2 < 5) then //要加括号
---------------------------
exit 跳出对象_
if Fraction >= 60 then
begin
writeln('你及格了');
exit; //跳出comparingfraction对象
end;
-------------------------
最小化到托盘_控件RzTrayIcon
----------------------
*project8