惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
A
About on SuperTechFans
IT之家
IT之家
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Blog — PlanetScale
Blog — PlanetScale
aimingoo的专栏
aimingoo的专栏
云风的 BLOG
云风的 BLOG
The GitHub Blog
The GitHub Blog
Vercel News
Vercel News
G
Google Developers Blog
J
Java Code Geeks
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
Cloudbric
Cloudbric
L
LINUX DO - 最新话题
MyScale Blog
MyScale Blog
H
Heimdal Security Blog
PCI Perspectives
PCI Perspectives
Attack and Defense Labs
Attack and Defense Labs
S
Security @ Cisco Blogs
Latest news
Latest news
I
Intezer
L
Lohrmann on Cybersecurity
C
CXSECURITY Database RSS Feed - CXSecurity.com
月光博客
月光博客
T
Threatpost
博客园 - 【当耐特】
S
Schneier on Security
P
Privacy International News Feed
G
GRAHAM CLULEY
T
Tenable Blog
AWS News Blog
AWS News Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
雷峰网
雷峰网
博客园 - Franky
Engineering at Meta
Engineering at Meta
美团技术团队
S
Secure Thoughts
T
Troy Hunt's Blog
Microsoft Security Blog
Microsoft Security Blog
SecWiki News
SecWiki News
V
Visual Studio Blog
人人都是产品经理
人人都是产品经理
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Cisco Talos Blog
Cisco Talos Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Martin Fowler
Martin Fowler
Webroot Blog
Webroot Blog
Google DeepMind News
Google DeepMind News
H
Hackread – Cybersecurity News, Data Breaches, AI and More

博客园 - 晓光

Android获取手机短信 Android系统的进程,任务,服务的信息 Android程序如何安装到内存或卡中 (转)解决Debug certificate expired的问题 (转)Android ViewGroup的onInterceptTouchEvent()事件分析 (转)禁止横屏和竖屏切换 (转)Android Bitmap 与 Drawable之间的转换 (转)Android中两种设置全屏的方法 (转)Android之getSystemService (转)Android Project Structure (转)SqlDateTime溢出类错误解决 C# 数据库连接字符串集合 - 晓光 - 博客园 Android Activity生命周期 Flex HttpService,WebService简单介绍 (转)Flex Module通信(2)——使用事件 (转)Flex Modules通信(1)——通过接口 (转)Canvas不能接收 rollOver和roolOut事件的解决方案 - 晓光 - 博客园 (转)FLEX中使用outerDocument - 晓光 - 博客园 (转)C# Hashtable Synchronized vs SyncRoot
(转)SQL Server Compact Edition 数据库连接字符串
晓光 · 2011-02-10 · via 博客园 - 晓光

本代码中包括了七种 SQL Server Compact Edition 数据库的连接字符串的写法:标准写法连接字符串、指定SDF文件连接字符串、对数据库加密连接字符串、只读访问连接字符串、互斥访问连接字符串等。

当直接拖放时使用的是 .NET Compact Framework Data Provider for SQL Server Mobile 标准连接字符串,其它字符串及用法在示例代码中。

标准连接

Data Source=MyData.sdf;Persist Security Info=False;

如果您正在使用SQL Server 2005 Express,在指库服务器名的时候,使用服务器名\实例名 作为数据源,来连接一个指定的SQL Server实例。

指定本地SDF文件的方法

通常情况下.SDF数据库并不运行在程序目录下,所以需要指定.SDF文件的路径。在这个例子里(.net C#)展示了当.SDF与应用程序在同一个文件夹时的一种处理方法。

Data Source=" + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\MyData.sdf;Persist Security Info=False;

指定数据库最大容量

默认最大容量为128M,可以通过下面的语法定义我们需要的容量。

Data Source=MyData.sdf;Max Database Size=256;Persist Security Info=False;

指定最大缓存容量

在服务器向磁盘中写入缓存之前,默认的可用最大内存缓存容量为640K,可以通过下面的语法定义我们需要的容量。

Data Source=MyData.sdf;Max Buffer Size=1024;Persist Security Info=False;

 

开启数据库加密

用这种语法格式开启数据库加密

Data Source=MyData.sdf;Encrypt Database=True;Password=myPassword;File Mode=shared read;Persist Security Info=False;

 

独占访问

使用这种语法,当你打开数据库的时候,其他进程无法访问或修改数据库。

Data Source=MyData.sdf;File Mode=Exclusive;Persist Security Info=False;

 

只读访问

使用这种语法,可以打开一个只读的数据库副本。

Data Source=MyData.sdf;File Mode=Read Only;Persist Security Info=False;

独占可读访问

用这种语法,可以确保当你打开数据库的时候,其他进程可以读取数据库,但无法修改。

Data Source=MyData.sdf;File Mode=Shared Read;Persist Security Info=False;

指定临时文件的最大容量

默认最大容量为128M,可以通过下面的语法定义我们需要的容量。

Data Source=MyData.sdf;Temp File Max Size=256;Persist Security Info=False;