Checking out the new ElasticScale of Microsoft and need to make a multiSharedConnection. Unfortunately this error arises :
DataSource must not be set in the connectionStringBuilder
my code is as simple as :
var aa = shardMap.GetShards(); // vars are for debuging
var ba = connstring;
using (MultiShardConnection conn = new MultiShardConnection(aa,ba ))
on debug connstring has this value:
"Server=tcp:MYSERVER.database.windows.net,1433;
User ID=nikatlas@MYSERVER;Password=MYPASS;
Trusted_Connection=False;Encrypt=True;Connection Timeout=30;"
Any ideas ?
I found the solution. Finally it seems that on the connection string the Server parameter should not be passed.
Probapbly the Data Source shown in exception is the same as Server
EDIT
As correctly commented by Jared Moore
"@MYSERVER" in the User ID also should not be specified. If your shard map has shards in multiple servers then having @MYSERVER will cause this error: "Server name cannot be determined. It must appear as the first segment of the server's dns name (servername.database.windows.net). Some libraries do not send the server name, in which case the server name must be included as part of the user name (username@servername). In addition, if both formats are used, the server names must match." –