c# - Connection String null reference exception in other systems -
i need set .dbml connection string because it's change after deploying.
test many posts in google no 1 works me.
here links test in app.
1. setting connection string in dbml files using linq sql in visual studio 2008
2. point connectionstring in dbml app.config
in app code, connection string
<add name="purewater.properties.settings.purewaterconnections" connectionstring="data source=.;initial catalog=purewater;integrated security=true" providername="system.data.sqlclient" />
according 1 , 2 abbove, set .dbml connection none , left empty. modify .dbml designer code.
after that, call data context (dbml) other windows forms this:
purewatercxtdatacontext cxt = new purewatercxtdatacontext(configurationmanager.connectionstrings["purewater.properties.settings.purewaterconnections"].connectionstring);
everything ok , don't have error on own system error on other systems on configurationmanager.connectionstrings
null reference. odd , can't trace exe file in other system what's happening?
thanks in advance help
update:
app.config file here:
<?xml version="1.0" encoding="utf-8" ?> <configuration xmlns:xdt="http://schemas.microsoft.com/xml-document-transform"> <configsections> </configsections> <connectionstrings> <add name="purewater.properties.settings.purewaterconnections" connectionstring="data source=.\sqlexpress;initial catalog=purewaterpartovi; integrated security=true;" providername="system.data.sqlclient" /> </connectionstrings> </configuration>
Comments
Post a Comment