I'm trying to set my connection string in my Entity Framework at runtime. In an attempt to do this, I have the following code:
string connectionString = "tcp:[serverName],[port];initial catalog=[databaseName];user id=[userName];password=[pwd];MultipleActiveResultSets=True;App=EntityFramework";
using (MyEntities entities = new MyEntities(connectionString))
{
MyEntity entity = new MyEntity();
// Set entity properties here
entities.MyEntities.Add(entity);
entities.SaveChanges();
}
When I get to the line that says entities.MyEntities.Add(entity), an exception is thrown. That exception has the following information:
Type: ArgumentException
Message: Keyword not supported: 'tcp:[serverName],[port];initial catalog'.
Why won't the code that I've written work? For the life of me, I can't figure it out.
Thank you!