M
mystergirl
Unregistered / Unconfirmed
GUEST, unregistred user!
[?][?][?]procedure Tfrmxsmx.Button3Click(Sender: TObject);
var
vxh,vid,vcsrq,vrxnf,lqsj,vzzmmdm,vmzdm,vxbdm,vzydm,vbjdm,vxzdm,vyzbm: string;
begin
if Edit35.Text='' then begin
ShowMessage('考生号不能为空,请重新输入~~!');
Edit35.SetFocus;
Exit;
end;
if Edit33.Text='' then begin
ShowMessage('姓名不能为空,请重新输入~~!');
Edit33.SetFocus;
Exit;
end;
begin
if length(StrToInt(Edit30.Text))<>15 and length(StrToInt(Edit30.Text))<>18 then
begin
ShowMessage('身份证号不能为空、位数不够或太长,请重新输入~~!');
Edit30.SetFocus;
Exit;
end;
end;
if Edit29.Text ='' then
begin
Showmessage('政治面貌不能为空,请选择政治面貌!');
Edit29.SetFocus;
Exit;
end
else
begin
with DM.ADOzzmmdmQuery do
begin
Close;
Parameters.ParamByName('zzmmmc').Value:=Edit35.Text;
Open;
vzzmmdm :=FieldValues['zzmmdm'];
Close;
end;
end;
if mzmc.Text='' then begin
ShowMessage('民族不能为空,请选择正确的民族~~!');
mzmc.SetFocus;
Exit;
end
else
begin
with DM.ADOmzdmQuery do
begin
Close;
Parameters.ParamByName('mzmc').Value:=mzmc.Text;
Open;
vmzdm :=FieldValues['mzdm'];
Close;
end;
end;
if xbmc.Text='' then begin
ShowMessage('系部名称不能为空,请选择正确的系部名称输入~~!');
xbmc.SetFocus;
Exit;
end
else
begin
with DM.ADOxbmcQuery do
begin
Close;
Parameters.ParamByName('xbmc').Value:=xbmc.Text;
Open;
vxbdm :=FieldValues['xbdm'];
Close;
end;
end;
if Edit40.Text='' then begin
ShowMessage('专业不能为空,请选择正确的专业~~!');
Edit40.SetFocus;
Exit;
end
else
begin
with DM.ADOzydmQuery do
begin
Close;
Parameters.ParamByName('zymc').Value:=Edit40.Text;
Open;
vxbdm :=FieldValues['zydm'];
Close;
end;
end;
if Edit41.Text='' then begin
ShowMessage('班级不能为空,请选择正确的班级~~!');
Edit41.SetFocus;
Exit;
end
else
begin
with DM.ADObjdmQuery do
begin
Close;
Parameters.ParamByName('bjmc').Value:=Edit41.Text;
Open;
vbjdm :=FieldValues['bjdm'];
Close;
end;
end;
if xzComboBox.Text='' then
begin
Showmessage('学制不能为空,请选择正确的学制!');
end
else
begin
with DM.ADOxzdmQuery do
begin
Close;
Parameters.ParamByName('xzmc').Value:=xzComboBox.Text;
Open;
vxzdm :=FieldValues['xzdm'];
Close;
end;
end;
if Edit36.Text='' then begin
ShowMessage('来源地区不能为空,请重新输入~~!');
Edit36.SetFocus;
Exit;
end;
if Edit31.Text='' then begin
ShowMessage('联系电话不能为空,请重新输入~~!');
Edit31.SetFocus;
Exit;
end;
if length(Edit28.Text)<>6 then begin
ShowMessage('邮政编码输入有误,请重新输入~~!');
Edit28.SetFocus;
Exit;
end;
begin
vRXNF :=FormatDateTime('yyyy',DateTimepicker2.DateTime);
begin
with DM.ADOxbrxQuery DO
begin
Close;
Parameters.ParamByName['rxnf'] :=vrxnf;
Parameters.ParamByName['xbdm'] :=vxbdm;
Open;
vid :=FieldValues['vid'];
Close;
end;
end;
end;
if length(xh.Text)=10 then
begin
if vid >right((xh.Text),4) or vid=right((xh.Text),4)then
begin
Showmessage('你输入的学号不对或已经存在,学号:2005040001,2005代表入学年份,04代表你所在系部编号,0001是序号,请选择生成学号或重新输入!');
xh.SetFocus;
end;
end;
SQL.Clear;
SQL.Add('Select * from xsjbxx Where xh='''+vxh+'''');
Open;
if RecordCount=0 then
begin
Break;
end
else
begin
Edit;
InsertRecord([xh.Text,Edit35.Text,Edit34.Text,Edit33.Text,Edit32.Text,Edit31.Text,FormatDateTime('yyyy-mm-dd',DateTimepicker1.DateTime),Edit30.Text,vzzmmdm,vmzdm,vxbdm,vzydm,vbjdm,ComboBox12.Text,vxzdm,Edit38.Text,Edit36.Text,jzxm.Text,Edit31.Text,Edit39.Text,Edit28.Text,Edit27.Text,Edit26.Text,Edit37.Text,FormatDateTime('yyyy-mm-dd',DateTimepicker2.DateTime)]);
post;
Button9.Click;
end;
end;
end.
在判断身份证号是否满足15或18位时,用上面的语句怎么会有错误呢?
ADOxbrxQuery:select right(max(id),4) AS VID FROM XSRX_VIEW
where rxnf =:rxnf and xbdm =:xbdm,用于取出学号满足用户输入为入学年份+系部代码(2004020012)时的最大值,这样的语句也是问题,请问是怎么会有错误呢?
InsertRecord插入新的数据时,为了省去界面不需要的字段值,只插入界面需要的字段值。
以上是用户输入学生基本信息时进行判断的语句,但调试时却出现很多的问题?请各位大师指点,急!!!
var
vxh,vid,vcsrq,vrxnf,lqsj,vzzmmdm,vmzdm,vxbdm,vzydm,vbjdm,vxzdm,vyzbm: string;
begin
if Edit35.Text='' then begin
ShowMessage('考生号不能为空,请重新输入~~!');
Edit35.SetFocus;
Exit;
end;
if Edit33.Text='' then begin
ShowMessage('姓名不能为空,请重新输入~~!');
Edit33.SetFocus;
Exit;
end;
begin
if length(StrToInt(Edit30.Text))<>15 and length(StrToInt(Edit30.Text))<>18 then
begin
ShowMessage('身份证号不能为空、位数不够或太长,请重新输入~~!');
Edit30.SetFocus;
Exit;
end;
end;
if Edit29.Text ='' then
begin
Showmessage('政治面貌不能为空,请选择政治面貌!');
Edit29.SetFocus;
Exit;
end
else
begin
with DM.ADOzzmmdmQuery do
begin
Close;
Parameters.ParamByName('zzmmmc').Value:=Edit35.Text;
Open;
vzzmmdm :=FieldValues['zzmmdm'];
Close;
end;
end;
if mzmc.Text='' then begin
ShowMessage('民族不能为空,请选择正确的民族~~!');
mzmc.SetFocus;
Exit;
end
else
begin
with DM.ADOmzdmQuery do
begin
Close;
Parameters.ParamByName('mzmc').Value:=mzmc.Text;
Open;
vmzdm :=FieldValues['mzdm'];
Close;
end;
end;
if xbmc.Text='' then begin
ShowMessage('系部名称不能为空,请选择正确的系部名称输入~~!');
xbmc.SetFocus;
Exit;
end
else
begin
with DM.ADOxbmcQuery do
begin
Close;
Parameters.ParamByName('xbmc').Value:=xbmc.Text;
Open;
vxbdm :=FieldValues['xbdm'];
Close;
end;
end;
if Edit40.Text='' then begin
ShowMessage('专业不能为空,请选择正确的专业~~!');
Edit40.SetFocus;
Exit;
end
else
begin
with DM.ADOzydmQuery do
begin
Close;
Parameters.ParamByName('zymc').Value:=Edit40.Text;
Open;
vxbdm :=FieldValues['zydm'];
Close;
end;
end;
if Edit41.Text='' then begin
ShowMessage('班级不能为空,请选择正确的班级~~!');
Edit41.SetFocus;
Exit;
end
else
begin
with DM.ADObjdmQuery do
begin
Close;
Parameters.ParamByName('bjmc').Value:=Edit41.Text;
Open;
vbjdm :=FieldValues['bjdm'];
Close;
end;
end;
if xzComboBox.Text='' then
begin
Showmessage('学制不能为空,请选择正确的学制!');
end
else
begin
with DM.ADOxzdmQuery do
begin
Close;
Parameters.ParamByName('xzmc').Value:=xzComboBox.Text;
Open;
vxzdm :=FieldValues['xzdm'];
Close;
end;
end;
if Edit36.Text='' then begin
ShowMessage('来源地区不能为空,请重新输入~~!');
Edit36.SetFocus;
Exit;
end;
if Edit31.Text='' then begin
ShowMessage('联系电话不能为空,请重新输入~~!');
Edit31.SetFocus;
Exit;
end;
if length(Edit28.Text)<>6 then begin
ShowMessage('邮政编码输入有误,请重新输入~~!');
Edit28.SetFocus;
Exit;
end;
begin
vRXNF :=FormatDateTime('yyyy',DateTimepicker2.DateTime);
begin
with DM.ADOxbrxQuery DO
begin
Close;
Parameters.ParamByName['rxnf'] :=vrxnf;
Parameters.ParamByName['xbdm'] :=vxbdm;
Open;
vid :=FieldValues['vid'];
Close;
end;
end;
end;
if length(xh.Text)=10 then
begin
if vid >right((xh.Text),4) or vid=right((xh.Text),4)then
begin
Showmessage('你输入的学号不对或已经存在,学号:2005040001,2005代表入学年份,04代表你所在系部编号,0001是序号,请选择生成学号或重新输入!');
xh.SetFocus;
end;
end;
SQL.Clear;
SQL.Add('Select * from xsjbxx Where xh='''+vxh+'''');
Open;
if RecordCount=0 then
begin
Break;
end
else
begin
Edit;
InsertRecord([xh.Text,Edit35.Text,Edit34.Text,Edit33.Text,Edit32.Text,Edit31.Text,FormatDateTime('yyyy-mm-dd',DateTimepicker1.DateTime),Edit30.Text,vzzmmdm,vmzdm,vxbdm,vzydm,vbjdm,ComboBox12.Text,vxzdm,Edit38.Text,Edit36.Text,jzxm.Text,Edit31.Text,Edit39.Text,Edit28.Text,Edit27.Text,Edit26.Text,Edit37.Text,FormatDateTime('yyyy-mm-dd',DateTimepicker2.DateTime)]);
post;
Button9.Click;
end;
end;
end.
在判断身份证号是否满足15或18位时,用上面的语句怎么会有错误呢?
ADOxbrxQuery:select right(max(id),4) AS VID FROM XSRX_VIEW
where rxnf =:rxnf and xbdm =:xbdm,用于取出学号满足用户输入为入学年份+系部代码(2004020012)时的最大值,这样的语句也是问题,请问是怎么会有错误呢?
InsertRecord插入新的数据时,为了省去界面不需要的字段值,只插入界面需要的字段值。
以上是用户输入学生基本信息时进行判断的语句,但调试时却出现很多的问题?请各位大师指点,急!!!