EDIT
RDP is just the current way I do this, if there is another way to connect to a database in a different environment I will do that. Ideally I want this to connect to the database as it would if the executable was in the RDP environment and show no indication of connecting to the DB via the other environment.
EDIT 2
I have also tried adding a second connection string and opening it then having my current connection string immediately after, that didn't work.
I have a C# Win Forms application which connects to a database, this works fine except I need to RDP into the correct environment and have the executable ran from there to do so.
Is it possible to do the RDP connection inside of the application then connect to the database without having to have the executable inside the RDP.
I have tried to build up a connection string using the MSTSCLib library which I found here however this isn't working at code level anyway.
Code:
private void rdpConnect_Click(object sender, EventArgs e)
{
MSTerminalServiceControl1.Server = rdpServer.Text;
MSTerminalServiceControl1.UserName = rdpUserName.Text;
IMsTscNonScriptable secured = (IMsTscNonScriptable)MSTerminalServiceControl1.GetOcx();
secured.ClearTextPassword = rdpPassword.Text;
MSTerminalServiceControl1.Connect();
}
private void rdpDisconnect_Click(object sender, EventArgs e)
{
MSTerminalServiceControl1.Disconnect();
}
Current Path:
Desired Path:

