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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
Microsoft Security Blog
Microsoft Security Blog
NISL@THU
NISL@THU
T
Threatpost
T
The Exploit Database - CXSecurity.com
T
Threat Research - Cisco Blogs
S
Securelist
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
S
Secure Thoughts
MyScale Blog
MyScale Blog
O
OpenAI News
P
Palo Alto Networks Blog
美团技术团队
C
Cyber Attacks, Cyber Crime and Cyber Security
TaoSecurity Blog
TaoSecurity Blog
量子位
L
Lohrmann on Cybersecurity
G
GRAHAM CLULEY
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
Tailwind CSS Blog
Know Your Adversary
Know Your Adversary
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Simon Willison's Weblog
Simon Willison's Weblog
宝玉的分享
宝玉的分享
PCI Perspectives
PCI Perspectives
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
I
InfoQ
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
S
Security @ Cisco Blogs
S
Schneier on Security
B
Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
The Cloudflare Blog
AWS News Blog
AWS News Blog
IT之家
IT之家
V
Vulnerabilities – Threatpost
The Hacker News
The Hacker News
H
Heimdal Security Blog
I
Intezer
A
Arctic Wolf
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
H
Help Net Security
W
WeLiveSecurity

博客园 - 晓光

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;