Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
error :Login failed for user 'primet_tmystem'.

when connecting to server ....
i have difine my connnection string in web.config

XML
<add name="CS" connectionString=" Data Source="servername;Initial Catalog=primet_TPSYSTEM;User ID="";Password="";"  providerName="System.Data.SqlClient" />
 </connectionStrings>

pls help ...
Posted

This is helpful to you
======================

Include NameSpaces also

C#
using System.Data.SqlClient;
using System.Web.configuration;

String connStr = ConfigurationManager.ConnectionStrings["DATABASENAMEConnectionString"].ConnectionString;


IN WEB.CONFIG File write this
=============================
HTML
<connectionstring>
<add name="DatabaseNameConnectionString" connectionstring="Data Source=Servername;Initial Catalog=DatabaseName;User ID=sa; Password=123" providername="System.Data.SqlClient" />
</connectionstring>
 
Share this answer
 
v2
Hi ,
Check this maybe it will help you
HTML
<add name="YourConnectionString" connectionString="server=localhost;database=TestDB;uid=123;password=123;" providerName="System.Data.SqlClient" />

<add name="NewString" connectionString="server=localhost;database=TestDB;uid=sa;password=secret;" providerName="System.Data.SqlClient" />

Also you can go to server explorer and make your conection ,and you can create udl file and make your conection
Best Regards
M.Mitwalli
 
Share this answer
 
Pass your credentials in connection string
C#
connectionString=" Data Source="servername;Initial Catalog=primet_TPSYSTEM;User ID="";Password=""; Persist Security Info=true"

See various connection string
http://www.connectionstrings.com/[^]

you can also create connection string using visual studio
Using Visual Studio to find a database connection string[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900