环境: window2000+delphi6+mssql2000存储过程:CREATE PROCEDURE dbo.CalGz @NameId bigint
ASbegin update gzb
set Zhgz=(GetJbgz+GetFdgz)*Dzfd where Nameid=@NameidUpDate Gzb
set Yfgzhj= (GetJbgz+GetFdgz)*Dzfd+GetBljt+GetZwbt+GetGz+
GetWsjt+GetYybt+GetLc+GetDbf+
GetHl+GetWc+GetJt+GetSd where Nameid=@Nameid
UpDate Gzb
set LoseXj= LoseFz+LoseSd+LoseGh+LoseZfgjj+LoseYlbxjj+LoseSybxjj+LoseQt where Nameid=@NameidUpDate Gzb
set Gzsfs=Yfgzhj-LoseXj where Nameid=@NameidUpdate gzb
set LoseGrsds=Round((Gzsfs+Syjjs-GetBljt-GetWsjt-GetYybt-GetDbf-800)*0.05,2) where (Gzsfs+Syjjs-GetBljt-GetWsjt-GetYybt-GetDbf-800)>0 and Nameid=@NameidUpDate Gzb
set LoseXj= LoseFz+LoseSd+LoseGh+LoseZfgjj+LoseYlbxjj+LoseSybxjj+LoseQt+LoseGrsds where Nameid=@NameidUpDate Gzb
set Gzsfs=Yfgzhj-LoseXj where Nameid=@Nameidend
GO我在设计工资录入界面时,先按‘增加’按钮,然后在dbedit中编辑,最后按‘保存’按钮结束。下面是‘保存’的代码:
(主要是TStoredProc的用法,其余的可以不看)procedure TRecForm.SpeedButton3Click(Sender: TObject);
Var i:integer;
begin
for i:=0 to Self.componentcount-1 do
begin
if Self.components[i] is Tdbedit then
(Self.components[i] as tdbedit).readonly:=True;
if Self.components[i] is TdbCombobox then
(Self.components[i] as TdbCombobox).readonly:=True;
if Self.components[i] is TdbLookupCombobox then
(Self.components[i] as TdbLookupCombobox).readonly:=True;
end;
SpeedButton3.Enabled:=True;
try
try
with DataT.Table4 do
begin
if not active then
open;
edit;
Post;
Bm:=Datat.Table4.BookMark; storedproc1.Close;
storedproc1.ParamByName('@Nameid').AsInteger:=StrToInt(dbedit1.Text);
Storedproc1.Prepare;
storedproc1.Open;
Datat.Table4.Active:=False;
Datat.Table4.Active:=True;
BookMark:=Bm;
end;
except
Application.MessageBox('数据发生错误!!!请运行<维护>---><数据清理>菜单项!!!','提示框',mb_ok+mb_iconstop);
abort; end;
Finally
Application.MessageBox('数据成功保存!!!','提示框',mb_ok+mb_iconinformation);
End;
end;我在‘Bm:=Datat.Table4.BookMark’处设了断点,但运行时,还没到这,就提示:
Field 'Nameid' must have a value.storedproc1 的配置如下:
object StoredProc1: TStoredProc
DatabaseName = 'MyGz'
StoredProcName = 'CalGz;1'
Left = 392
ParamData = <
item
DataType = ftInteger
Name = '@RETURN_VALUE'
ParamType = ptResult
end
item
DataType = ftInteger
Name = '@NameId'
ParamType = ptInput
Value = 20177
end>
end不解决此问题,就不洗澡!!!
望高手赐教!
ASbegin update gzb
set Zhgz=(GetJbgz+GetFdgz)*Dzfd where Nameid=@NameidUpDate Gzb
set Yfgzhj= (GetJbgz+GetFdgz)*Dzfd+GetBljt+GetZwbt+GetGz+
GetWsjt+GetYybt+GetLc+GetDbf+
GetHl+GetWc+GetJt+GetSd where Nameid=@Nameid
UpDate Gzb
set LoseXj= LoseFz+LoseSd+LoseGh+LoseZfgjj+LoseYlbxjj+LoseSybxjj+LoseQt where Nameid=@NameidUpDate Gzb
set Gzsfs=Yfgzhj-LoseXj where Nameid=@NameidUpdate gzb
set LoseGrsds=Round((Gzsfs+Syjjs-GetBljt-GetWsjt-GetYybt-GetDbf-800)*0.05,2) where (Gzsfs+Syjjs-GetBljt-GetWsjt-GetYybt-GetDbf-800)>0 and Nameid=@NameidUpDate Gzb
set LoseXj= LoseFz+LoseSd+LoseGh+LoseZfgjj+LoseYlbxjj+LoseSybxjj+LoseQt+LoseGrsds where Nameid=@NameidUpDate Gzb
set Gzsfs=Yfgzhj-LoseXj where Nameid=@Nameidend
GO我在设计工资录入界面时,先按‘增加’按钮,然后在dbedit中编辑,最后按‘保存’按钮结束。下面是‘保存’的代码:
(主要是TStoredProc的用法,其余的可以不看)procedure TRecForm.SpeedButton3Click(Sender: TObject);
Var i:integer;
begin
for i:=0 to Self.componentcount-1 do
begin
if Self.components[i] is Tdbedit then
(Self.components[i] as tdbedit).readonly:=True;
if Self.components[i] is TdbCombobox then
(Self.components[i] as TdbCombobox).readonly:=True;
if Self.components[i] is TdbLookupCombobox then
(Self.components[i] as TdbLookupCombobox).readonly:=True;
end;
SpeedButton3.Enabled:=True;
try
try
with DataT.Table4 do
begin
if not active then
open;
edit;
Post;
Bm:=Datat.Table4.BookMark; storedproc1.Close;
storedproc1.ParamByName('@Nameid').AsInteger:=StrToInt(dbedit1.Text);
Storedproc1.Prepare;
storedproc1.Open;
Datat.Table4.Active:=False;
Datat.Table4.Active:=True;
BookMark:=Bm;
end;
except
Application.MessageBox('数据发生错误!!!请运行<维护>---><数据清理>菜单项!!!','提示框',mb_ok+mb_iconstop);
abort; end;
Finally
Application.MessageBox('数据成功保存!!!','提示框',mb_ok+mb_iconinformation);
End;
end;我在‘Bm:=Datat.Table4.BookMark’处设了断点,但运行时,还没到这,就提示:
Field 'Nameid' must have a value.storedproc1 的配置如下:
object StoredProc1: TStoredProc
DatabaseName = 'MyGz'
StoredProcName = 'CalGz;1'
Left = 392
ParamData = <
item
DataType = ftInteger
Name = '@RETURN_VALUE'
ParamType = ptResult
end
item
DataType = ftInteger
Name = '@NameId'
ParamType = ptInput
Value = 20177
end>
end不解决此问题,就不洗澡!!!
望高手赐教!
解决方案 »
- 关于cxGrid的问题
- 怎样把整个word文档存储进access或其它数据数据库?
- fast report打印:在A4纸张上打印a5的报表?
- 谁有将阴历日期转为公历日期的程序代码??
- FASTREPORT中大写金额函数的问题?
- 菜鸟问题:如何反馈cmd中的结果??
- 十六转字符问题,得分简单
- 急求解决动态EDIT值的问题
- 谁能告诉我SystemParametersInfo这个函数的各个具体参数吗?
- 哪里可以搞到DOA(Direct Access Oracle 3.30的源码?
- 为什么我的应用程序关闭了,而进程却没有结束?
- 百分求Microsoft Photodraw、Microsoft Publisher下载。(小弟急用,斑竹勿删,谢谢)
StoredProcedure 的用法应该是正确的。不过存储过程没有返回结果集,应该用 Exec 来调用,而不是 Open。
storedproc1.ParamByName('@Nameid').AsInteger:=StrToInt(dbedit1.Text);
Storedproc1.Prepare;
storedproc1.Open;} 注销了,还是出现Field 'Nameid' must have a value.这说明不是代码的问题,而是TStoredProc的用法有问题!
检查以下吧