Hi Sebastian,
The best way to do this is to use InfoPath 2007's UDCs. If this is unavailable you could try changing the data connections in code depending on where the form is being opened from. I don't know the exact syntax and I'm away from my dev box right now, but it'd go something like this: Put this code in the OnLoad.
OnLoad()
{
//...
string sURI = thisXDocument.SolutionURI; // This might be on thisApplication
switch( sURI )
{
case "http://devServer":
UpdateDataConnections( "http://devServer/DataconnectionString" );
break;
// Fill in the rest here
}
//...
}
private void UpdateDataConnections( string uri )
{
// Not sure if it should be DataAdapters or DataObjects
//foreach( DataAdapter adapter in thisXDocument.DataAdapters )
foreach( DataObjects adapter in thisXDocument.DataObjects )
{
if( adapter instanceof WebServiceAdapter )
adapter.URI = uri;
}
}
Hopefully you catch the drift, but if you hit problems, let me know!
Matt Faus / Microsoft InfoPath MVPQdabra® Software / Streamline data gathering to turn process into knowledge