why you can’t set TargetUrl in runtime like
Channel.TargetUrl := 'http://127.0.0.1:8090/bin';
?
why you can’t set TargetUrl in runtime like
Channel.TargetUrl := 'http://127.0.0.1:8090/bin';
?
Hi,
I set TargetUrl in runtime that read from INI. But it doesn’t work. Then I test it directly without read from INI file.
Hi,
can you create a simple testcase that reproduces this behavior, pls?
you can attach it here or send directly to support@ for keeping privacy.
Hi,
I confirmed the problem is the application setting when compile to EXE. I set the DCP to “Runtime Packages”. If I remove it, I can using TargetUrl in runtime.
Thanks!
Hi,
Any news about the issue of “ClientDataModule.RemoteDataAdapter.FillWithDASql(Connection, DAMemDataTable1, ComboBox2.text, nil)”?
Hi,
sorry but this isn’t fixed yet
Hi,
Any suggestion to control the different connection without the following error? If user need to switch different forms with different connections, then will easy to got the error. I need to special handle the action. Is it possible handle in DA Server?
Hi,
the easiest way - switch connection manually.
you can create a new custom method like
procedure SwitchToConnection(aConnectionName: string);
or
procedure SwitchToConnection(aTable: String);
in second method you can check schema for connection for given table/command
Hi,
Haha… I already use this solution. But it is so trouble that I need to add each time for running SQL. Because my main form and security control are under the other connection. I need to always switch the connections between system control and features control.
Hi,
also you can try to use TDASqlProcessor.OnValidateTable
event and return valid IDAConnection object instead of manual changing of connection.
it can be something like
procedure TDataService.DASqlProcessorValidateTable(aTableName: string;
var aConnection: IDAConnection);
var
dt: TDADataset;
st: TDAStatement;
cn: TDAConnection;
begin
dt := ServiceSchema.Datasets.FindDatasetByName(aTableName);
if dt <> nil then begin
if dt.Statements.Count = 1 then begin
st := dt.Statements[0];
if st.Connection <> '' then begin
if (aConnection <> nil) and (aConnection.Name = st.Connection) then Exit;
aConnection := ServiceSchema.ConnectionManager.NewConnection(st.Connection);
Exit;
end;
if st.ConnectionType <> '' then begin
if (aConnection <> nil) and (aConnection.ConnectionType = st.ConnectionType) then Exit;
cn := ServiceSchema.ConnectionManager.Connections.FindConnection('', st.ConnectionType);
if cn <> nil then
aConnection := ServiceSchema.ConnectionManager.NewConnection(cn.Name);
Exit;
end;
end;
end;
end;
Noted with thanks. I will try it.
Hi,
I tried to remove my “ChangeConnection” procedure. It still has an error. Need I to doing some handling in client side? If I apply my “ChangeConnection”, it will not have an error.
Hi,
what method you are using on client-side? RDA.FillWithDASql
?
Hi,
I use the simple method as below.
sp_SysRight.Close;
sp_SysRight.ParamByName('Lang').Value := Sys_Language;
sp_SysRight.Open;
Hi,
what is sp_SysRight
?
Hi,
sp_SysRight is a SQL stored procedure. I added into DA Schema.
Hi,
what type has sp_SysRight
?
is it DA component like TDAMemDatatable
or something else?
Hi,
It is a TDAMemDataTable. I also debug the DA server that hasn’t jump in the event.
Hi,
EDIT: updated solution is provided
add the GetConnectionForObject
method and call above method.
protected
function GetConnectionForObject(const aName: string): IDAConnection; override;
..
function TDataService.GetConnectionForObject(
const aName: string): IDAConnection;
begin
Result := inherited GetConnectionForObject(aName);
DASqlProcessor1.OnValidateTable(aName, Result);
end;
Note: it won’t work with tables from different DB.
Hi,
Can you create a simple project that reproduces this error, pls?
you can drop it to support@ directly for keeping privacy