请教使用firedac做datasnap数据库服务器
答案:2 悬赏:40 手机版
解决时间 2021-11-30 16:14
- 提问者网友:沦陷
- 2021-11-30 07:30
请教使用firedac做datasnap数据库服务器
最佳答案
- 五星知识达人网友:神也偏爱
- 2021-11-30 07:58
服务端的方法定义在 ServerMethodsUnit1.cpp中。
调用两个方法的例子
Samples\CPP\DataSnap\SimpleDataSnapDemo\CppDataSnapClient\DataSnapClientClasses.cpp
System::UnicodeString __fastcall TServerMethods1Client::EchoString(System::UnicodeString value)
{
if (FEchoStringCommand == NULL)
{
FEchoStringCommand = FDBXConnection->CreateCommand();
FEchoStringCommand->CommandType = TDBXCommandTypes_DSServerMethod;
FEchoStringCommand->Text = "TServerMethods1.EchoString";
FEchoStringCommand->Prepare();
}
FEchoStringCommand->Parameters->Parameter[0]->Value->SetWideString(value);
FEchoStringCommand->ExecuteUpdate();
System::UnicodeString result = FEchoStringCommand->Parameters->Parameter[1]->Value->GetWideString();
return result;
}
System::UnicodeString __fastcall TServerMethods1Client::ReverseString(System::UnicodeString value)
{
if (FReverseStringCommand == NULL)
{
FReverseStringCommand = FDBXConnection->CreateCommand();
FReverseStringCommand->CommandType = TDBXCommandTypes_DSServerMethod;
FReverseStringCommand->Text = "TServerMethods1.ReverseString";
FReverseStringCommand->Prepare();
}
FReverseStringCommand->Parameters->Parameter[0]->Value->SetWideString(value);
FReverseStringCommand->ExecuteUpdate();
System::UnicodeString result = FReverseStringCommand->Parameters->Parameter[1]->Value->GetWideString();
return result;
}
调用两个方法的例子
Samples\CPP\DataSnap\SimpleDataSnapDemo\CppDataSnapClient\DataSnapClientClasses.cpp
System::UnicodeString __fastcall TServerMethods1Client::EchoString(System::UnicodeString value)
{
if (FEchoStringCommand == NULL)
{
FEchoStringCommand = FDBXConnection->CreateCommand();
FEchoStringCommand->CommandType = TDBXCommandTypes_DSServerMethod;
FEchoStringCommand->Text = "TServerMethods1.EchoString";
FEchoStringCommand->Prepare();
}
FEchoStringCommand->Parameters->Parameter[0]->Value->SetWideString(value);
FEchoStringCommand->ExecuteUpdate();
System::UnicodeString result = FEchoStringCommand->Parameters->Parameter[1]->Value->GetWideString();
return result;
}
System::UnicodeString __fastcall TServerMethods1Client::ReverseString(System::UnicodeString value)
{
if (FReverseStringCommand == NULL)
{
FReverseStringCommand = FDBXConnection->CreateCommand();
FReverseStringCommand->CommandType = TDBXCommandTypes_DSServerMethod;
FReverseStringCommand->Text = "TServerMethods1.ReverseString";
FReverseStringCommand->Prepare();
}
FReverseStringCommand->Parameters->Parameter[0]->Value->SetWideString(value);
FReverseStringCommand->ExecuteUpdate();
System::UnicodeString result = FReverseStringCommand->Parameters->Parameter[1]->Value->GetWideString();
return result;
}
全部回答
- 1楼网友:煞尾
- 2021-11-30 09:22
delphi datasnap firedac
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯
正方形一边上任一点到这个正方形两条对角线的 |
阴历怎么看 ? |