Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
end;
分别按学号、姓名、寝室号查找学生:
procedure TForm_info_q2.Button1Click(Sender: TObject);
begin
  Image1.Picture:=nil;                  //照片置空
  query1.Close;
  query1.SQL.Clear;
  query1.SQL.Add('select * from student where sno=:sno');
  query1.ParamByName('sno').AsString:=Edit5.Text;
  query1.Open;
  if query1.RecordCount>0 then     //如果有这个学号的学生,载入照片
Image1.Picture.LoadFromFile(form_main.projectdir.caption+'\image\'+query1.FieldList.Fields[0].Value+'.bmp')
  else
  begin
    showmessage('没有这个学生!');
    Edit5.SetFocus;
  end;
end;
添加学生信息窗体:
procedure TForm_infos_s.Button1Click(Sender: TObject);
begin
  if Edit1.Text<>'' then
  begin
    with Form_infos_s.query1 do
    begin
      close;
      sql.Clear;
      sql.Add('insert into student  values(:sno,:sdept,:time_s,:sname,:ssex,:Num_room,:Num_bed,:remark)');
      ParamByName('sno').AsString:=Form_infos_s.Edit1.Text;
      ParamByName('sdept').AsString:=Form_infos_s.ComboBox1.Text;
      ParamByName('time_s').AsString:=Form_infos_s.ComboBox2.Text;
      ParamByName('sname').AsString:=Form_infos_s.Edit2.Text;
      if RadioButton1.Checked then
        ParamByName('ssex').AsString:='男';
      if RadioButton2.Checked then
        ParamByName('ssex').AsString:='女';
      ParamByName('Num_room').AsString:=Form_infos_s.Edit3.Text;
      ParamByName('Num_bed').AsString:=Form_infos_s.Edit4.Text;
      ParamByName('remark').AsString:=Form_infos_s.Memo1.Text;
      Form_infos_s.query1.ExecSQL;
      //if  Form_infos.Image1.Picture.
      Form_infos_s.Image1.Picture.SaveToFile(form_main.projectdir.caption+'\image\'+Edit1.Text+'.bmp');
      query2.ParamByName('Num_room').AsString:=edit3.Text;
      query2.ExecSQL;
      showmessage('OK,添加成功!');
      Form_infos_s.Close;
    end;
  end
  else
  begin
    showmessage('请填写学号!');
  end;
end;
procedure TForm_infos_s.Edit1Exit(Sender: TObject);
begin
  query3.Close;      // 下面的query3.Open使得query3处于active状态,不再接受再次的参数赋值
  query3.ParamByName('sno').AsString:=edit1.Text;
  query3.Open;
  if query3.RecordCount>0 then
 
首页 上一页 1 2 3 4 5 6 下一页 尾页 3/6/6
sql2000+公寓管理系统+delphi[开题报告+文档+源代码+答辩ppt+外文翻译](三)由毕业论文网(www.huoyuandh.com)会员上传。

