错误的连接字符串 [英] Error connection string

查看:87
本文介绍了错误的连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误:用户"primet_tmystem"的登录失败.

连接到服务器时....
我在web.config中定义了连接字符串

error :Login failed for user ''primet_tmystem''.

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

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


请帮助...


pls help ...

推荐答案

这对您有帮助
=====================

还包括命名空间

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

Include NameSpaces also

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

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



在WEB.CONFIG文件中写入此
===========================



IN WEB.CONFIG File write this
=============================

<connectionstring>
<add name="DatabaseNameConnectionString" connectionstring="Data Source=Servername;Initial Catalog=DatabaseName;User ID=sa; Password=123" providername="System.Data.SqlClient" />
</connectionstring>



选中它也许会对您有所帮助
Hi ,
Check this maybe it will help you
<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" />


您也可以转到服务器资源管理器进行连接,然后创建udl文件并进行连接
最好的问候
M.Mitwalli


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


在连接字符串中传递凭据
Pass your credentials in connection string
connectionString=" Data Source="servername;Initial Catalog=primet_TPSYSTEM;User ID="";Password=""; Persist Security Info=true"


查看各种连接字符串
http://www.connectionstrings.com/ [^ ]

您还可以使用Visual Studio创建连接字符串


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[^]


这篇关于错误的连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆