简体   繁体   English

如何通过传递数据库名称访问WPF中的SQL Server数据库

[英]How to access SQL Server database in WPF via passing database name

I am using Ado.Net Connectivity Framework in my WPF application. 我在WPF应用程序中使用Ado.Net Connectivity Framework。

There is kind of a form in my MainWindow.xaml file. 我的MainWindow.xaml文件中有一种表单。 This form has two fields one is asking for database name and second is for PC Name. 此表单有两个字段,一个是要求数据库名称,另一个是PC名称。

Questions: 问题:

  1. I want to pass these values to App.config File in my WPF application. 我想将这些值传递给我的WPF应用程序中的App.config文件。 How to pass these values? 如何传递这些值?

  2. Secondly I have to make my database centralized and my application launched from different computers have to access this centralized database? 其次, 我必须集中我的数据库,从不同的计算机启动我的应用程序必须访问这个集中的数据库?

  3. The way I am making this to access centralized database via these above defined fields is right way or is this is not a way to achieve required goal? 我通过以上定义的字段访问集中式数据库的方式是正确的方法还是这不是实现所需目标的方法?

在此输入图像描述

We found an answer based on a good sized chat discussion . 我们根据大小合适的聊天讨论找到了答案。

His solution will probably require 1 of 2 things. 他的解决方案可能需要两件事中的一件。

  1. Host a WCF service that performs CRUD operations on his database. 托管在其数据库上执行CRUD操作的WCF服务
  2. Use a service like No IP to create a public location to his local machine, open ports for his database, and run the application with a direct connection. 使用No IP等服务为其本地计算机创建公共位置,为其数据库打开端口,并使用直接连接运行应用程序。 (he is aware of the limitations/security problems this creates) (他知道这造成的限制/安全问题)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM