How to resolve connection string error..

Posted by Parthibansk under ASP.NET on 8/24/2012 | Points: 10 | Views : 1194 | Status : [Member] | Replies : 5
The connection name 'EMPLOYEEConnectionString2' was not found in the applications configuration or the connection string is empty.

wen i host the page in server.. i get dis error..but works fine locally..

i chkd in web.config too.. connection string is present..

Data Source=PARTHI-PC\SQLEXPRESS;Initial Catalog=EMPLOYEE;Integrated Security=True..


should i change to authetication to sqlsever..




Responses

Posted by: Vikash on: 8/24/2012 [Member] Starter | Points: 25

Up
0
Down
Plz provide complete code of we.config file

your code should be something like this....
<connectionString>
<add name="EMPLOYEEConnectionString2" connectionString="Data Source=PARTHI-PC\SQLEXPRESS;Initial Catalog=EMPLOYEE;Integrated Security=True"/>
</connectionString>
or
<appSettings>
<add key="" value="Data Source=PARTHI-PC\SQLEXPRESS;Initial Catalog=EMPLOYEE;Integrated Security=True"/>
</appSettings>

Regards,
Vikash Pathak

Parthibansk, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Parthibansk on: 8/24/2012 [Member] Starter | Points: 25

Up
0
Down

<connectionStrings>
<add name="BillPro" connectionString="Data Source=rajeev-vista-32\sqlexpress2008;Initial Catalog=BillPro;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="EMPLOYEEConnectionString" connectionString="Data Source=PARTHI-PC\SQLEXPRESS;Initial Catalog=EMPLOYEE;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="BILLPROConnectionString" connectionString="Data Source=PARTHI-PC\SQLEXPRESS;Initial Catalog=BILLPRO;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="BILLPROConnectionString2" connectionString="Data Source=PARTHI-PC\SQLEXPRESS;Initial Catalog=BILLPRO;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="EMPLOYEEConnectionString2" connectionString="Data Source=PARTHI-PC\SQLEXPRESS;Initial Catalog=EMPLOYEE;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>


Parthibansk, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shanky11 on: 8/24/2012 [Member] Starter | Points: 25

Up
0
Down
Data Source="PARTHI-PC\\SQLEXPRESS;Initial Catalog=EMPLOYEE;Integrated Security=True"
copy and paste it

Parthibansk, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vasanthmvp on: 8/24/2012 [Member] Starter | Points: 25

Up
0
Down
Hi, I think you have missed something..

You should have included the Trusted_Connection = true; (if it is of windows authentication).

(OR)

add the login credentials if it is of Sql Server Authentication in the connection string like:
Persist Security Info=True;User ID=(something);Password=(something);

Regards,

Awesome Coding !! :)

Parthibansk, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 8/24/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
@Parthibansk
Change ur Data Souce Path.
Data Source=PARTHI-PC\SQLEXPRESS; // its works only on local machine.

after hosting on server u can use like...
 

<add name="cn" connectionString="Data Source=DataBaseServerIPaddress; Initial Catalog=DataBaseName;
User ID="YourUserID"; Password='YourPassword';" providerName="System.Data.SqlClient"/>

DataBaseServerIpAddress looks like (192.168.14.90)


Parthibansk, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response