如何连接到我的sql数据库 [英] How do I connect to my sql data base

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

问题描述

你好

我有一个带有这个app.config代码的项目:



add name =" connection string" connection String =" Server = .\SQLExpress;

AttachDbFilename = | Data Directory | \bonyad.mdf; Trusted_Connection = Yes;" providerName =" System.Data.SqlClient"



但是当有必要打开数据库时建立连接

出现此错误消息:

尝试为文件C附加自动命名的数据库:... \bin\Debug\bonyad.mdf失败。存在具有相同名称的数据库,或者无法打开指定的文件,或者它位于UNC共享上。



感谢您的帮助

hello
i have a project with this app.config code:

add name="connection string" connection String="Server=.\SQLExpress;
AttachDbFilename=|Data Directory|\bonyad.mdf;Trusted_Connection=Yes;" providerName="System.Data.SqlClient"

But when it is necessary to open the database connection is established
This error message appears:
An attempt to attach an auto-named database for file C:...\bin\Debug\bonyad.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

Thanks for your help

推荐答案

使用此链接:



http://forum.codecall.net/topic/71422-connecting-to-a- mysql-database-in-c /
use this link:

http://forum.codecall.net/topic/71422-connecting-to-a-mysql-database-in-c/


您是否在Google上搜索此错误?

故障排除错误:尝试为文件'C:\附加自动命名的数据库数据库文件路径'失败。存在具有相同名称的数据库,或者无法打开指定的文件,或者它位于UNC共享上 [ ^ ]
Did you search Google for this error?
Troubleshoot Error: An attempt to attach an auto-named database for file 'C:\database file path' failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share[^]


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

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