Hi
in my windows form application, (for some reasons) i've encrypt my connectionString in configuration file & decrypt it then place to an static variable. It works correctly.
Now to change all tableAdapters in my app to set it's connectionString to my static variable, i've written this code which use reflection to access connection information of the given tableAdapter(s) :
public static void InitAdapters(Component[] arrComponents)
{
foreach (Component cmp in arrComponents)
{
PropertyInfo pConnection = cmp.GetType().GetProperty("Connection", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
object objConnection = pConnection.GetValue(cmp, null);
PropertyInfo pConnectionString = objConnection.GetType().GetProperty("ConnectionString");
pConnectionString.SetValue(objConnection, Singleton.StaticConnectionString, null);
}
}
my problem is that, i'm facing this error :
Format of the initialization string does not conform to specification starting at index 0
at line :
object objConnection = pConnection.GetValue(cmp, null);
The interesting part is at debug mode, when arrives to the given line, i've add to quick watch & re evaluate then it works!!!!!!
What's the problem & how to solve it?
Thanks in advance