访问MDF文件表单.Net Compact Framework [英] Accessing MDF file form .Net Compact Framework

查看:101
本文介绍了访问MDF文件表单.Net Compact Framework的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个数据库项目来从.net紧凑框架应用程序访问sql server mdf吗?

am doing a database project to access sql server mdf from .net compact framework application ?

 

我的意思是服务器客户端应用程序。从客户端访问服务器数据?可以访问MDF文件吗?

i mean server client application . from client side am accessing the server datas ? is that possible to access the MDF file ?

 

请整理我的问题?

推荐答案

总之,没有。 您没有合适的驱动程序来读取该文件。 但是,忘记"文件"并将其视为需要从Windows CE客户端访问SQL Server数据。 你*可以*那样做。 当然,你必须为一个真实的,可远程访问的SQL Server实例(没有SQL Server Express,真实的东西)安排
的数据。 如果您这样做,则有一个用于SQL Server客户端的.NET Compact Framework类库,SQL Server .NET数据提供程序。 使用
这些类通过网络连接到SQL Server并与之通信。 我认为你也可以使用OLE DB和本机代码,但我永远不会这样做; .NET CF界面非常好用,可以为您处理所有困难的东西并且正常工作。

In a word, no.  You don't have a suitable driver to read that file.  However, forget about 'files' and think about this as a need to access SQL Server data from a Windows CE client.  You *can* do that.  Of course, you'll have to arrange for the data to be known to a real, remote-accessible instance of SQL Server (no SQL Server Express; the real thing).  If you do that, there is a library of .NET Compact Framework classes for SQL Server clients, SQL Server .NET Data Provider.  Use those classes to connect to and communicate with the SQL Server over the network.  I presume that you could use OLE DB and native code, too, but I'd never do that; the .NET CF interface is very nice, handles all of the hard stuff for you and just works.

您需要知道的比特:

System.Data.SqlClient - 包含SQL客户端类的程序集引用

System.Data.SqlClient - assembly reference that contains the SQL client classes

SqlConnection - 用于建立从客户端应用程序到SQL Server的连接的类

SqlConnection - class used to make the connection from your client application to the SQL Server

" 数据源 = myServerAddress; 初始目录 = myDataBase; 集成安全性 = SSPI; 用户ID = myDomain \ myUsername; 密码 = myPassword ;"
- 用于连接服务器的连接字符串格式。  myServerAddress通常是一个IP地址。 myDataBase将是服务器知道与MDB文件关联的数据库的名称。 可能不需要myDomain,
,具体取决于SQL Server的配置方式。 如果您使用SQL Server用户名和密码,而不是基于Windows的身份验证,那么您只需要一个myUsername和myPassword。 在这种情况下,这些项目不会对应任何Windows
标识,而是对应于SQL Server中为数据库创建的用户名和密码。

"Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;User ID=myDomain\myUsername;Password=myPassword;" - format of connection string to use to connect to the server.  myServerAddress will usually be an IP address. myDataBase will be the name by which the database, associated with the MDB file, is known to the server.  myDomain may not be necessary, depending on how the SQL Server is configured.  If you use SQL Server user names and passwords, rather than Windows-based authentication, then you'd just need a myUsername and myPassword.  In that case, those items wouldn't correspond to any Windows identity, but to the user name and password created in SQL Server for the database.

我正在愚弄这一点,并且会提供一些关于创建与文件对应的数据库身份的更具体的说明,如果我到达那里......

Paul T。


这篇关于访问MDF文件表单.Net Compact Framework的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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