我是个新手,刚接手delphi程序,公司原程序有问题我就是看不懂,麻烦各位高手指导一下,这个程序是以前同事编写的,是一个交接班及数据录入、查询程序,到一定的时间就会自动生成一条空记录让操作人员录入数据,每天的白班和夜班交接时要写交接记录,现在的问题就是交接班记录写上后保存不了,他们操作人员输入后点保存,再点查询就无法显示刚写的记录,而我的后台数据库中却能看到他们写的记录,请问这个是什么原因啊?是显示代码错误吗?
白班记录可以看到,就是点夜班记录无法看到。下面是我吧程序调用出来点查询后的代码,各位看一下又什么不对的地方谢谢!!这就是交接班查询窗口的代码,希望高手指导一下,如果有不合理的地方请说清楚怎么改,谢谢
我qq 17919139 邮箱 gryy69@163.com 希望各位多多指教!!
unit Unit_jjbcx;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, DB, ADODB;
type
TFormjjbcx = class(TForm)
Label1: TLabel;
DateTimePicker1: TDateTimePicker;
Label3: TLabel;
ComboBox1: TComboBox;
Button1: TButton;
Button2: TButton;
Memo1: TMemo;
ADOQuery1: TADOQuery;
ADOConnection1: TADOConnection;
DataSource1: TDataSource;
GroupBox2: TGroupBox;
Label2: TLabel;
Label4: TLabel;
Edit3: TEdit;
Edit4: TEdit;
GroupBox1: TGroupBox;
Label5: TLabel;
Label6: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Label7: TLabel;
ComboBox2: TComboBox;
ADOQuery2: TADOQuery;
DataSource2: TDataSource;
DataSource3: TDataSource;
ADOQuery3: TADOQuery;
procedure FormShow(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Formjjbcx: TFormjjbcx;
implementation
{$R *.dfm}
procedure TFormjjbcx.FormShow(Sender: TObject);
begin
DateTimePicker1.Date:=now;
memo1.Text:='';
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit4.Text:='';
end;
procedure TFormjjbcx.Button1Click(Sender: TObject);
var insertdate:string;
jjr1,jjr11:string;
jjr2,jjr12:string;
jjr3,jjr13:string;
jjr4,jjr14:string;
begin
// DateTimePicker1.Date:=now;
DateSeparator := '-';
ShortDateFormat := 'yyyy-mm-dd';
insertdate := DateToStr(DateTimePicker1.Date);
adoquery1.Close;
adoquery1.SQL.Text:='select jjb,jbr1,jbr2,jbrr1,jbrr2 from jjbjl where substring(convert(char(19),sj,20),1,10)='''+insertdate+''' and sbmc='''+combobox1.Text+''' and bc='''+combobox2.Text+'''';
adoquery1.Open;
if adoquery1.RecordCount>0 then
{ begin
memo1.Text:=adoquery1.FieldByName('jjb').AsString;
edit1.Text:=adoquery1.fieldbyname('jbr1').AsString;
edit2.Text:=adoquery1.fieldbyname('jbr2').AsString;
edit3.Text:=adoquery1.fieldbyname('jbrr1').AsString;
edit4.Text:=adoquery1.fieldbyname('jbrr2').AsString;
end; }
begin
//adoquery2.Close;
// adoquery2.SQL.Text:='select * from jjbjl where substring(convert(char(19),sj,20),1,10)='''+DateToStr(DateTimePicker1.Date)+'''' ;
//adoquery2.open;
// if adoquery2.Recordset.RecordCount>0 then
// begin
// sj:=adoquery2.Recordset.Fields['sj'].Value;
//jjb:=adoquery1.Recordset.Fields['jjb'].Value;
jjr1:=adoquery1.Recordset.Fields['jbr1'].Value;
jjr2:=adoquery1.Recordset.Fields['jbr2'].Value;
jjr3:=adoquery1.Recordset.Fields['jbrr1'].Value;
jjr4:=adoquery1.Recordset.Fields['jbrr2'].Value;
adoquery3.Close;
adoquery3.SQL.Text:='select xm from jjrdm where dm='''+jjr1+'''' ;
adoquery3.open;
jjr11:=adoquery3.Recordset.Fields['xm'].Value;
adoquery3.Close;
adoquery3.SQL.Text:='select xm from jjrdm where dm='''+jjr2+'''' ;
adoquery3.open;
jjr12:=adoquery3.Recordset.Fields['xm'].Value;
adoquery3.Close;
adoquery3.SQL.Text:='select xm from jjrdm where dm='''+jjr3+'''' ;
adoquery3.open;
jjr13:=adoquery3.Recordset.Fields['xm'].Value;
adoquery3.Close;
adoquery3.SQL.Text:='select xm from jjrdm where dm='''+jjr4+'''' ;
adoquery3.open;
jjr14:=adoquery3.Recordset.Fields['xm'].Value;
//hour1:=copy(sj,12,2);
// hour2:=strtoint(hour1);
memo1.Text:='';
// memo2.Text:='';
//if hour2<12 then
//begin
// memo1.Text:=memo1.text+'交班人:'+trim(jjr11)+' '+trim(jjr12)+#13#10;
// memo1.Text:=memo1.text+'接班人:'+trim(jjr13)+' '+trim(jjr14);
//end
//else
// begin
// memo2.Text:='时间:'+#13#10+sj+#13#10+#13#10+'交接班日志:'+#13#10+jjb+#13#10+#13#10;
// memo2.Text:=memo2.text+'交班人:'+trim(jjr11)+' '+trim(jjr12)+#13#10;
// memo2.Text:=memo2.text+'接班人:'+trim(jjr13)+' '+trim(jjr14);
// end;
memo1.Text:=adoquery1.FieldByName('jjb').AsString;
edit1.Text:=trim(jjr11);
edit2.Text:=trim(jjr12);
edit3.Text:=trim(jjr13);
edit4.Text:=trim(jjr14);
end
else
begin
application.MessageBox('该时间范围内数据!','提示信息',mb_ok);
end ;
end;
procedure TFormjjbcx.Button2Click(Sender: TObject);
begin
Formjjbcx.Hide;
end;
end.