Q
qwertyangyang
Unregistered / Unconfirmed
GUEST, unregistred user!
求救,求救!!!很考你的能力的问题喔!!!
急!急!急!我有两个表,后台数据库是MYSQL5。现在我想从四个表t_classroomestimate,t_classroomestimate_cad ,t_classroomestimate_exp, t_classroomestimate_teac和表t_indexweight,t_indexweight_cad中取数值,然后作相乘,具体的公式是第一次量化得出被评教员所获得的原始分值,其模型如下:
6 n
h=(∑∑kij(aijA+bijB+cijC+dijD))/m
i=1 j=1
式中:
h为某位老师被某个班学生(某位专家、领导、同行)所评原始分值;
i为某个一级指标,j为第i个一级指标下的某个二级指标;
n为第i个一级指标所含的二级指标数;
m为参与评价的有效样本数,进行领导、专家评价时, m=1;
kij为 中的各二级指标的权重系数;
aij、bij 、cij 、dij 分别 为勾选个二级指标A、B、C、D个等级的样本数之和,也就是对应A,B,C,D下的那些值,且aij+bij+cij+dij= m;
各评价等级赋值情况为:A=10,B=8,C=6,D=4。
第二次量化是对由同一类型评价得出的原始分值进行标准化处理,降低因不同评价者对标准尺度掌握不同而导致的不可比性,以便根据得分将所有被评教师同意进行排序。以学员评价为例,其模型如下:q=10w*f +50 式中:q为某位教师被某个班学生所评原始分的二次量化值;
w 为该教师被该班所评原始分值的标准分,其计算方法为:
w =(h-g)/s
其中,h为该教师被该班所评原始分值; g为该班所评所有教师原始分值的平均值;s 为该班所评所有教师原始分值的标准差,其计算方法为:
________
s= /r
√∑(h –g)/r
O=1
注意!!!!其中(h-g)还有平方的
r为该班所评教师个数;
f为评价因子,其值为: 当S大于L时f等于S除以L,当s小于等于L时,f等于一 。L参加排序的所有班所有原始分值标准差的平均值。
经上述处理后,若多个班对该教员评分,则算出各个分值的算术平均值,即为被评教师所得学员评价的最后得分。
其余类型评价数据的二次量化可照次方法进行。
我的想法是从前面那四个中的一个表中取数据出来和后面两个表中取数据出来做第一次量化算法,把算出来的值存入一个新建的表中。再从这个表中取数据出来做第二次量化。八只存进表t_esti_cad,t_esti_col,t_esti_exp,t_esti_tea中的一个表中。
我用SQL语言从四个表t_classroomestimate,t_classroomestimate_cad ,t_classroomestimate_exp, t_classroomestimate_teac和表t_indexweight,t_indexweight_cad中读数据,再从后两个表t_indexweight,t_indexweight_cad中读数据,由于第一次用PASCAL语言,很多方面不太懂。以前都是用C++,C语言,朋友来问我这个问题,把我难住了,求助大家拉,帮帮忙忙啊!朋友急着用啊!拜托!
程序如下:(也就是前面那四个表的程序,数据从里面取)
unit esti_qry;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, ComCtrls,datamodule, Menus, StdCtrls, Buttons;
type
TForm_esti_qry = class(TForm)
pgc1: TPageControl;
ts1: TTabSheet;
ts2: TTabSheet;
pm1: TPopupMenu;
N1: TMenuItem;
ts3: TTabSheet;
dbgrd2: TDBGrid;
dbgrd3: TDBGrid;
dbgrd1: TDBGrid;
ts4: TTabSheet;
dbgrd4: TDBGrid;
procedure N1Click(Sender: TObject);
//procedure N3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form_esti_qry: TForm_esti_qry;
implementation
{$R *.dfm}
procedure TForm_esti_qry.N1Click(Sender: TObject);
begin
close;
end;
{procedure TForm_esti_qry.N3Click(Sender: TObject);
begin
var sqlstr1:string;
sqlstr2:string;
sqlstr1:='select teachername from t_classroomestimate_cad where teachername =:teacname' ;
sqlstr1:='select staffroom_name from t_classroomestimate_cad where staffroom_name =:staname';
with DataModule_main.ADOQuery_qry_cad_tea do
begin
Close;
sql.clear;
sql.add(sqlstr1);
parameters.ParamByName('teacname').Value :=
execsql;
end;
begin
Close;
sql.clear;
sql.add(sqlstr2);
parameters.ParamByName('staname').Value :=
execsql;
end;}
end.
第二个程序(我只拿了一个程序啊,就是表t_indexweight_cad 的,有些是同一种程序写法的我把它删了,因为太长了)
unit esti_cadet;interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, Menus, Grids, DBGrids, ExtCtrls;
type
TForm_esti_cadet = class(TForm) pm1: TPopupMenu; N1: TMenuItem; dbgrd1: TDBGrid; N2: TMenuItem; grp1: TGroupBox; lbl2: TLabel; lbl4: TLabel; lbl6: TLabel; lbl1: TLabel; btn1: TBitBtn; btn2: TBitBtn; cbb2: TComboBox; cbb1: TComboBox; cbb3: TComboBox; cbb4: TComboBox; btn3: TBitBtn; grp2: TGroupBox; mmo1: TMemo; grp3: TGroupBox; rg1: TRadioGroup; RadioGroup1: TRadioGroup; RadioGroup5: TRadioGroup; RadioGroup6: TRadioGroup; RadioGroup7: TRadioGroup; RadioGroup10: TRadioGroup; RadioGroup11: TRadioGroup; RadioGroup12: TRadioGroup; RadioGroup15: TRadioGroup; RadioGroup16: TRadioGroup; RadioGroup20: TRadioGroup; RadioGroup21: TRadioGroup; RadioGroup25: TRadioGroup; procedure btn1Click(Sender: TObject);
procedure formcreate(sender:tobject);
procedure btn2Click(Sender: TObject);
procedure btn3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form_esti_cadet: TForm_esti_cadet;
countA,countB,countC,countD:Integer;
implementation
uses datamodule;
{$R *.dfm}
procedure Tform_esti_cadet.formcreate(sender:tobject);
var
sqlstr1: string; sqlstr2: string; sqlstr3: string; sqlstr4: string;
begin
sqlstr1 := 'select staffroom_name from t_staffroom';
sqlstr2 := 'select course_name from t_course';
sqlstr3 := 'select teachername from t_teacher';
sqlstr4 := 'select cadetteam_name from t_cadetteam';
cbb2.Items.Clear;
cbb1.Items.Clear; cbb3.Items.Clear; cbb4.Items.Clear;
try
with datamodule_main.ADOQuery_sta do
begin
close;
sql.clear;
sql.add(sqlstr1);
open;
first;
while not eof do
begin
cbb2.Items.Add(fieldbyname('staffroom_name').asstring);
next;
end;
end;
except
end;
procedure TForm_esti_cadet.btn1Click(Sender: TObject);
begin
close;
end;
procedure TForm_esti_cadet.btn2Click(Sender: TObject);
var sqlstr:string;
begin
if application.MessageBox('确实要提交该评估数据?','确认提交',mb_okcancel)=idok then
case rg1.ItemIndex of
0: sqlstr := 'update t_classroomestimate_cad set A=A+1 WHERE cadetteam_name =:stra and course =:strb and teachername =:strc and staffroom =:strd and subject=''c11'' ';
1: sqlstr := 'update t_classroomestimate_cad set B=B+1 WHERE cadetteam_name =:stra and course =:strb and teachername =:strc and staffroom =:strd and subject=''c11'' ';
2: sqlstr := 'update t_classroomestimate_cad set C=C+1 WHERE cadetteam_name =:stra and course =:strb and teachername =:strc and staffroom =:strd and subject=''c11'' ';
3: sqlstr := 'update t_classroomestimate_cad set D=D+1 WHERE cadetteam_name =:stra and course =:strb and teachername =:strc and staffroom =:strd and subject=''c11'' ';
end;
with datamodule_main.ADOQuery_esti_cad do
begin
Close;
sql.clear;
sql.add(sqlstr);
parameters.ParamByName('stra').Value :=trim(cbb4.text);
parameters.ParamByName('strb').Value :=trim(cbb1.text);
parameters.ParamByName('strc').Value :=trim(cbb3.text);
parameters.ParamByName('strd').Value :=trim(cbb2.text);
execsql;
end;
rg1.ItemIndex := -1; RadioGroup1.ItemIndex :=-1; RadioGroup5.ItemIndex :=-1; RadioGroup6.ItemIndex :=-1; RadioGroup7.ItemIndex :=-1; RadioGroup10.ItemIndex :=-1; RadioGroup11.ItemIndex :=-1; RadioGroup12.ItemIndex :=-1; RadioGroup15.ItemIndex :=-1; RadioGroup16.ItemIndex :=-1; RadioGroup20.ItemIndex :=-1; RadioGroup21.ItemIndex :=-1; RadioGroup25.ItemIndex :=-1;
ShowMessage('评分提交成功!,请提交下一份表单!');
end;
procedure TForm_esti_cadet.btn3Click(Sender: TObject);
begin
if application.MessageBox('确实要提交该评估信息?','确认提交',mb_okcancel)=idok then
if (cbb1.Text='') then
begin
ShowMessage('请将四项基础信息填写完整再进行评分工作');
cbb4.SetFocus;
end
else
begin
DataModule_main.ADODataSet_esti_cad.insert ;
datamodule_main.ADODataSet_esti_cad.FieldByName('course').Value :=cbb1.Text ;
datamodule_main.ADODataSet_esti_cad.FieldByName('subject').Value :=rg1.Caption;
datamodule_main.ADODataSet_esti_cad.FieldByName('teachername').Value:=cbb3.Text;
datamodule_main.ADODataSet_esti_cad.FieldByName('A').Value:=0;
datamodule_main.ADODataSet_esti_cad.FieldByName('B').Value:=0;
datamodule_main.ADODataSet_esti_cad.FieldByName('C').Value:=0;
datamodule_main.ADODataSet_esti_cad.FieldByName('D').Value:=0;
datamodule_main.ADODataSet_esti_cad.FieldByName('staffroom').Value:=cbb2.Text;
datamodule_main.ADODataSet_esti_cad.FieldByName('cadetteam_name').Value:=cbb4.Text;
DataModule_main.ADODataSet_esti_cad.UpdateBatch;
ShowMessage('基本信息提交成功!');
end;
end;
end.
输出具体结果的程序也就是表t_esti_cad,t_esti_col,t_esti_exp,t_esti_tea的程序
unit qry_tea;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Grids, DBGrids, StdCtrls,datamodule, ComCtrls, Menus;
type
TForm_qry_tea = class(TForm) pgc1: TPageControl; ts1: TTabSheet; grp2: TGroupBox; ts2: TTabSheet; GroupBox2: TGroupBox; ts3: TTabSheet; grp3: TGroupBox; ts4: TTabSheet; grp4: TGroupBox; dbgrd2: TDBGrid; dbgrd1: TDBGrid; dbgrd3: TDBGrid; dbgrd4: TDBGrid;
procedure formcreate(sender:Tobject);
private { Private declarations }
public { Public declarations }
end;
var
Form_qry_tea: TForm_qry_tea;
implementation
{$R *.dfm}
procedure tform_qry_tea.formcreate(sender:Tobject);
begin
with datamodule_main.ADOQuery_qry_col_tea do
begin
close;
with sql do
begin
clear;
add('select * from t_esti_col');
end;
execsql;
open;
end;
end;
end.:
急!急!急!我有两个表,后台数据库是MYSQL5。现在我想从四个表t_classroomestimate,t_classroomestimate_cad ,t_classroomestimate_exp, t_classroomestimate_teac和表t_indexweight,t_indexweight_cad中取数值,然后作相乘,具体的公式是第一次量化得出被评教员所获得的原始分值,其模型如下:
6 n
h=(∑∑kij(aijA+bijB+cijC+dijD))/m
i=1 j=1
式中:
h为某位老师被某个班学生(某位专家、领导、同行)所评原始分值;
i为某个一级指标,j为第i个一级指标下的某个二级指标;
n为第i个一级指标所含的二级指标数;
m为参与评价的有效样本数,进行领导、专家评价时, m=1;
kij为 中的各二级指标的权重系数;
aij、bij 、cij 、dij 分别 为勾选个二级指标A、B、C、D个等级的样本数之和,也就是对应A,B,C,D下的那些值,且aij+bij+cij+dij= m;
各评价等级赋值情况为:A=10,B=8,C=6,D=4。
第二次量化是对由同一类型评价得出的原始分值进行标准化处理,降低因不同评价者对标准尺度掌握不同而导致的不可比性,以便根据得分将所有被评教师同意进行排序。以学员评价为例,其模型如下:q=10w*f +50 式中:q为某位教师被某个班学生所评原始分的二次量化值;
w 为该教师被该班所评原始分值的标准分,其计算方法为:
w =(h-g)/s
其中,h为该教师被该班所评原始分值; g为该班所评所有教师原始分值的平均值;s 为该班所评所有教师原始分值的标准差,其计算方法为:
________
s= /r
√∑(h –g)/r
O=1
注意!!!!其中(h-g)还有平方的
r为该班所评教师个数;
f为评价因子,其值为: 当S大于L时f等于S除以L,当s小于等于L时,f等于一 。L参加排序的所有班所有原始分值标准差的平均值。
经上述处理后,若多个班对该教员评分,则算出各个分值的算术平均值,即为被评教师所得学员评价的最后得分。
其余类型评价数据的二次量化可照次方法进行。
我的想法是从前面那四个中的一个表中取数据出来和后面两个表中取数据出来做第一次量化算法,把算出来的值存入一个新建的表中。再从这个表中取数据出来做第二次量化。八只存进表t_esti_cad,t_esti_col,t_esti_exp,t_esti_tea中的一个表中。
我用SQL语言从四个表t_classroomestimate,t_classroomestimate_cad ,t_classroomestimate_exp, t_classroomestimate_teac和表t_indexweight,t_indexweight_cad中读数据,再从后两个表t_indexweight,t_indexweight_cad中读数据,由于第一次用PASCAL语言,很多方面不太懂。以前都是用C++,C语言,朋友来问我这个问题,把我难住了,求助大家拉,帮帮忙忙啊!朋友急着用啊!拜托!
程序如下:(也就是前面那四个表的程序,数据从里面取)
unit esti_qry;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, ComCtrls,datamodule, Menus, StdCtrls, Buttons;
type
TForm_esti_qry = class(TForm)
pgc1: TPageControl;
ts1: TTabSheet;
ts2: TTabSheet;
pm1: TPopupMenu;
N1: TMenuItem;
ts3: TTabSheet;
dbgrd2: TDBGrid;
dbgrd3: TDBGrid;
dbgrd1: TDBGrid;
ts4: TTabSheet;
dbgrd4: TDBGrid;
procedure N1Click(Sender: TObject);
//procedure N3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form_esti_qry: TForm_esti_qry;
implementation
{$R *.dfm}
procedure TForm_esti_qry.N1Click(Sender: TObject);
begin
close;
end;
{procedure TForm_esti_qry.N3Click(Sender: TObject);
begin
var sqlstr1:string;
sqlstr2:string;
sqlstr1:='select teachername from t_classroomestimate_cad where teachername =:teacname' ;
sqlstr1:='select staffroom_name from t_classroomestimate_cad where staffroom_name =:staname';
with DataModule_main.ADOQuery_qry_cad_tea do
begin
Close;
sql.clear;
sql.add(sqlstr1);
parameters.ParamByName('teacname').Value :=
execsql;
end;
begin
Close;
sql.clear;
sql.add(sqlstr2);
parameters.ParamByName('staname').Value :=
execsql;
end;}
end.
第二个程序(我只拿了一个程序啊,就是表t_indexweight_cad 的,有些是同一种程序写法的我把它删了,因为太长了)
unit esti_cadet;interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, Menus, Grids, DBGrids, ExtCtrls;
type
TForm_esti_cadet = class(TForm) pm1: TPopupMenu; N1: TMenuItem; dbgrd1: TDBGrid; N2: TMenuItem; grp1: TGroupBox; lbl2: TLabel; lbl4: TLabel; lbl6: TLabel; lbl1: TLabel; btn1: TBitBtn; btn2: TBitBtn; cbb2: TComboBox; cbb1: TComboBox; cbb3: TComboBox; cbb4: TComboBox; btn3: TBitBtn; grp2: TGroupBox; mmo1: TMemo; grp3: TGroupBox; rg1: TRadioGroup; RadioGroup1: TRadioGroup; RadioGroup5: TRadioGroup; RadioGroup6: TRadioGroup; RadioGroup7: TRadioGroup; RadioGroup10: TRadioGroup; RadioGroup11: TRadioGroup; RadioGroup12: TRadioGroup; RadioGroup15: TRadioGroup; RadioGroup16: TRadioGroup; RadioGroup20: TRadioGroup; RadioGroup21: TRadioGroup; RadioGroup25: TRadioGroup; procedure btn1Click(Sender: TObject);
procedure formcreate(sender:tobject);
procedure btn2Click(Sender: TObject);
procedure btn3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form_esti_cadet: TForm_esti_cadet;
countA,countB,countC,countD:Integer;
implementation
uses datamodule;
{$R *.dfm}
procedure Tform_esti_cadet.formcreate(sender:tobject);
var
sqlstr1: string; sqlstr2: string; sqlstr3: string; sqlstr4: string;
begin
sqlstr1 := 'select staffroom_name from t_staffroom';
sqlstr2 := 'select course_name from t_course';
sqlstr3 := 'select teachername from t_teacher';
sqlstr4 := 'select cadetteam_name from t_cadetteam';
cbb2.Items.Clear;
cbb1.Items.Clear; cbb3.Items.Clear; cbb4.Items.Clear;
try
with datamodule_main.ADOQuery_sta do
begin
close;
sql.clear;
sql.add(sqlstr1);
open;
first;
while not eof do
begin
cbb2.Items.Add(fieldbyname('staffroom_name').asstring);
next;
end;
end;
except
end;
procedure TForm_esti_cadet.btn1Click(Sender: TObject);
begin
close;
end;
procedure TForm_esti_cadet.btn2Click(Sender: TObject);
var sqlstr:string;
begin
if application.MessageBox('确实要提交该评估数据?','确认提交',mb_okcancel)=idok then
case rg1.ItemIndex of
0: sqlstr := 'update t_classroomestimate_cad set A=A+1 WHERE cadetteam_name =:stra and course =:strb and teachername =:strc and staffroom =:strd and subject=''c11'' ';
1: sqlstr := 'update t_classroomestimate_cad set B=B+1 WHERE cadetteam_name =:stra and course =:strb and teachername =:strc and staffroom =:strd and subject=''c11'' ';
2: sqlstr := 'update t_classroomestimate_cad set C=C+1 WHERE cadetteam_name =:stra and course =:strb and teachername =:strc and staffroom =:strd and subject=''c11'' ';
3: sqlstr := 'update t_classroomestimate_cad set D=D+1 WHERE cadetteam_name =:stra and course =:strb and teachername =:strc and staffroom =:strd and subject=''c11'' ';
end;
with datamodule_main.ADOQuery_esti_cad do
begin
Close;
sql.clear;
sql.add(sqlstr);
parameters.ParamByName('stra').Value :=trim(cbb4.text);
parameters.ParamByName('strb').Value :=trim(cbb1.text);
parameters.ParamByName('strc').Value :=trim(cbb3.text);
parameters.ParamByName('strd').Value :=trim(cbb2.text);
execsql;
end;
rg1.ItemIndex := -1; RadioGroup1.ItemIndex :=-1; RadioGroup5.ItemIndex :=-1; RadioGroup6.ItemIndex :=-1; RadioGroup7.ItemIndex :=-1; RadioGroup10.ItemIndex :=-1; RadioGroup11.ItemIndex :=-1; RadioGroup12.ItemIndex :=-1; RadioGroup15.ItemIndex :=-1; RadioGroup16.ItemIndex :=-1; RadioGroup20.ItemIndex :=-1; RadioGroup21.ItemIndex :=-1; RadioGroup25.ItemIndex :=-1;
ShowMessage('评分提交成功!,请提交下一份表单!');
end;
procedure TForm_esti_cadet.btn3Click(Sender: TObject);
begin
if application.MessageBox('确实要提交该评估信息?','确认提交',mb_okcancel)=idok then
if (cbb1.Text='') then
begin
ShowMessage('请将四项基础信息填写完整再进行评分工作');
cbb4.SetFocus;
end
else
begin
DataModule_main.ADODataSet_esti_cad.insert ;
datamodule_main.ADODataSet_esti_cad.FieldByName('course').Value :=cbb1.Text ;
datamodule_main.ADODataSet_esti_cad.FieldByName('subject').Value :=rg1.Caption;
datamodule_main.ADODataSet_esti_cad.FieldByName('teachername').Value:=cbb3.Text;
datamodule_main.ADODataSet_esti_cad.FieldByName('A').Value:=0;
datamodule_main.ADODataSet_esti_cad.FieldByName('B').Value:=0;
datamodule_main.ADODataSet_esti_cad.FieldByName('C').Value:=0;
datamodule_main.ADODataSet_esti_cad.FieldByName('D').Value:=0;
datamodule_main.ADODataSet_esti_cad.FieldByName('staffroom').Value:=cbb2.Text;
datamodule_main.ADODataSet_esti_cad.FieldByName('cadetteam_name').Value:=cbb4.Text;
DataModule_main.ADODataSet_esti_cad.UpdateBatch;
ShowMessage('基本信息提交成功!');
end;
end;
end.
输出具体结果的程序也就是表t_esti_cad,t_esti_col,t_esti_exp,t_esti_tea的程序
unit qry_tea;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Grids, DBGrids, StdCtrls,datamodule, ComCtrls, Menus;
type
TForm_qry_tea = class(TForm) pgc1: TPageControl; ts1: TTabSheet; grp2: TGroupBox; ts2: TTabSheet; GroupBox2: TGroupBox; ts3: TTabSheet; grp3: TGroupBox; ts4: TTabSheet; grp4: TGroupBox; dbgrd2: TDBGrid; dbgrd1: TDBGrid; dbgrd3: TDBGrid; dbgrd4: TDBGrid;
procedure formcreate(sender:Tobject);
private { Private declarations }
public { Public declarations }
end;
var
Form_qry_tea: TForm_qry_tea;
implementation
{$R *.dfm}
procedure tform_qry_tea.formcreate(sender:Tobject);
begin
with datamodule_main.ADOQuery_qry_col_tea do
begin
close;
with sql do
begin
clear;
add('select * from t_esti_col');
end;
execsql;
open;
end;
end;
end.: