无法加入数据库链接 [英] can't join database link

查看:79
本文介绍了无法加入数据库链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编码如下:-


coding is below:-


try 
{
 sqlconnection Con1 = new SqlConnection ("Data source =.\\server name; Initial catalog= database name; Integrated Security= True;User Instance=True");
Con1.Open();
SqlCommand cmd1 = new SqlCommand (qry, Con1);
int i = cmd1.ExecuteNonQuery();
Con1.close();
Response.Redirect("");
}
catch (Exception e12)
{
lblmsg.Text= e12.Message;
}




请解决这个问题




plz solve this problem

推荐答案

亲爱的,
请尝试以下.
如果您的数据库是本地分配的,则使用此连接字符串

sqlconnection Con1 =新的SqlConnection(@数据源=.\服务器名称;初始目录=数据库名称;集成安全性= True;");

其他

sqlconnection Con1 =新的SqlConnection(@数据源= IPAddress \服务器名称;初始目录=数据库名称;集成安全性= True;");

谢谢

Mahesh Patel
hi dear,
try below.
if your database is allocated local then use this connection string

sqlconnection Con1 = new SqlConnection (@"Data source =.\server name; Initial catalog= database name; Integrated Security= True;");

else

sqlconnection Con1 = new SqlConnection (@"Data source =IPAddress\server name; Initial catalog= database name; Integrated Security= True;");

thankyou

Mahesh Patel


这篇关于无法加入数据库链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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