本地数据库连接字符串 [英] Local Database Connection Strings

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

问题描述

当我创建数据集时,将出现"选择您的数据连接"窗口,并且我创建的所有连接字符串列表将显示在标题"应用程序用于连接数据库的数据连接?"下的下拉框中。 ;
 我想要一个且只有一个连接字符串。  如何删除所有不需要的连接字符串?  我想删除所有当前字符串并创建一个新字符串。  我正在使用Microsoft.Jet.OLEDB.4.0,并且数据库是在Access中创建的。
 我想这样做的原因是我无法弄清楚Visual Studio存储数据库的位置。  运行程序时出错,解决问题的唯一方法是知道Visual Studio访问数据库的位置。  如果我删除
已知位置的所有数据库并尝试运行该程序,我仍然会收到相同的错误。  我将表设置为不接受重复的条目,这是我收到的错误消息。  我想如果我可以删除所有现有的连接字符串并且
创建一个新的连接字符串,那么我应该能够找到Visual Studio与之通信的数据库。

解决方案

您可以在我最近做的MSDN代码示例中遍历Visual Studio中的连接对话框的源代码(警告有大量代码)。


https://code.msdn.microsoft.com/Using-Visual-Studio-a7e740f8 ?导向= 0


When I create a dataset the Choose Your Data Connection window appears and a list of all the connection strings I created appears in the drop down box under the heading "Which data connection should your application use to connect to the database?"  I want one and only one connection string.  How do I remove all unwanted connection strings?  I want to remove all current strings and create one new string.  I'm using Microsoft.Jet.OLEDB.4.0 and the database was created in Access.  The reason I want to do this is that I can't figure out where Visual Studio stores my database.  I get an error when I run the program and the only way I can fix the problem is to know where Visual Studio is accessing the database.  If I delete all databases in known locations and try running the program I still get the same error.  I have the table set to not accept duplicate entries, which is the error message I get.  I figure that if I can remove all the existing connection strings and create a new one then I should be able to find the database that Visual Studio communicates with.

解决方案

You could traverse the source code (warning there is a good deal of code) for the connection dialog in Visual Studio in a MSDN code sample I did recently.

https://code.msdn.microsoft.com/Using-Visual-Studio-a7e740f8?redir=0


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

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