XE7 DataSnap存储过程传递参数问题?

CB1013 2015-05-18 12:14:31
服务端:
procedure TServerMethods1.GuestQry(Act, Rno, GName, Gtype, sArr, eArr, sLea,
eLea, SaleId, Birthday, Sta, Bal, Ydr, Rtype, T: String);
begin
with GuestQuery do
begin
Close;
Parameters.ParamByName('@Account').Value :=Act;
Parameters.ParamByName('@RoomNo').Value :=Rno;
Parameters.ParamByName('@Name').Value :=GName;
Parameters.ParamByName('@GuestType').Value :=Gtype;
Parameters.ParamByName('@sArrDate').Value :=sArr;
Parameters.ParamByName('@eArrDate').Value :=eArr;
Parameters.ParamByName('@sLeaDate').Value :=sLea;
Parameters.ParamByName('@eLeaDate').Value :=eLea;
Parameters.ParamByName('@SaleId').Value :=SaleId;
Parameters.ParamByName('@Birthday').Value :=Birthday;
Parameters.ParamByName('@State').Value :=Sta;
Parameters.ParamByName('@Balance').Value :=Bal;
Parameters.ParamByName('@Ydr').Value :=Ydr;
Parameters.ParamByName('@RoomType').Value :=Rtype;
Parameters.ParamByName('@T').Value :=T;
Prepared;
Open;
end;
end;
客户端:
procedure TForm1.Button1Click(Sender: TObject);
var
ReturnDataSet: OleVariant;
begin
SQLConnection1.Open;
FParam := TServerMethods1Client.Create(SQLConnection1.DBXConnection);
try
ReturnDataSet := FParam.GuestQry('','','','','','','','','','','I','','','','1'); //这句报错
ClientDataSet1.Data:=ReturnDataSet;
ClientDataSet1.Open;
finally
FreeAndNil(FParam);
SQLConnection1.Close;
end;
end;
错误信息: E2010 Incompatible types: 'OleVariant' and 'procedure, untyped pointer or untyped parameter'
刚接触不知这种方法好不好,有没有更好的方法。还请各位大哥帮忙
...全文
302 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
13427617410 2015-08-11
  • 打赏
  • 举报
回复
楼主 可否加我和我讲下你是怎么实现的 ? 我QQ187294890
CB1013 2015-05-19
  • 打赏
  • 举报
回复
问题已解决, 谢谢
lyhoo163 2015-05-18
  • 打赏
  • 举报
回复
1、服务器方法,无返回值。是一个过程(不是函数)。 procedure TServerMethods1.GuestQry(Act, Rno, GName, Gtype, sArr, eArr, sLea, eLea, SaleId, Birthday, Sta, Bal, Ydr, Rtype, T: String); 2、客户端调用该方法,要求有返回值,就要出错了。 ReturnDataSet := FParam.GuestQry('','','','','','','','','','','I','','','','1'); 改直接调用即可: FParam.GuestQry('','','','','','','','','','','I','','','','1');
CB1013 2015-05-18
  • 打赏
  • 举报
回复
在DELPHI2007下没问题 if act<>'' then GuestQuery.Parameters.ParamByName('@Account').Value :=act else GuestQuery.Parameters.ParamByName('@Account').Value :=Null; 现在改成DELPHI XE7下 if act<>'' then GuestQuery.Parameters.ParamByName('@Account').Value :=act else GuestQuery.Parameters.ParamByName('@Account').Value :=Null;//一输入NULL就提示未定义
lyhoo163 2015-05-18
  • 打赏
  • 举报
回复
是否参数赋值时,nil nill混淆。
CB1013 2015-05-18
  • 打赏
  • 举报
回复
现在改成: function TServerMethods1.GuestQry(Act, Rno, GName, Gtype, sArr, eArr, sLea, eLea, SaleId, Birthday, Sta, Bal, Ydr, Rtype, T: String): OleVariant; 再问下: GuestQuery.Parameters.ParamByName('@Account').Value :=Null;//提示Null没定义

2,497

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧