zoukankan      html  css  js  c++  java
  • Connection strings for SQL Server Compact Edition

    .NET Compact Framework Data Provider for SQL Server Mobile

    Type .NET Framework Class Library
    Usage System.Data.SqlServerCe.SqlCeConnection
    Manufacturer Microsoft

    Standard

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

    How to specify the location of the SDF file

    Often times the .SDF database is not running in the current directory so it becomes necessary to programatically set the path to the SDF file. This is an example (.net C#) on how to do this when the SDF file is located in the same directory as the executing application.

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

    Standard

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

    Specifying the maximum database size

    The maximum size of the database is by default 128 MB. Override this by using the following connection string.

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

    Specifying the maximum buffer size

    The largest amount of memory that can be in use before the server starts flushing changes to disk is by default 640 kB. Override this by using the following connection string.

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

    Encryption enabled

    Use this connection string to enable encryption on the database.

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

    The Encrypt Database="True" pair is really not necessary as the presence of the Password-parameter itself turns on encryption for the connection.

     
     

    Exclusive access

    Use this one to disallow other processes from opening or modifying the database while you have it open.

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

    Read only access

    Use this one to open a read-only copy of the database.

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

    Exclusive but shared for reading

    Use this one to allow other processes to read, but not modify, the database while you have it open.

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

    Specifying the maximum temp file size

    The maximum size of the temporary database file is by default 128 MB. Override this by using the following connection string.

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

    Microsoft.SQLSERVER.CE.OLEDB.3.5

    Type OLE DB Provider
    Usage Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5
    Manufacturer Microsoft

    Standard

    Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=myPath\myData.sdf;
     
     

    Microsoft.SQLSERVER.MOBILE.OLEDB.3.0

    Type OLE DB Provider
    Usage Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0
    Manufacturer Microsoft

    Standard

    Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=myPath\myData.sdf;
     
     

    How to specify the location of the SDF file

    Often times the .SDF database is not running in the current directory so it becomes necessary to programatically set the path to the SDF file. This is an example (.net C#) on how to do this when the SDF file is located in the same directory as the executing application.

    Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=" + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\MyData.sdf;
     
     

    Specifying the maximum database size

    The maximum size of the database is by default 128 MB. Override this by using the following connection string.

    Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=myPath\myData.sdf;SSCE:Max Database Size=256;
     
     

    Specifying the maximum buffer size

    The largest amount of memory that can be in use before the server starts flushing changes to disk is by default 640 kB. Override this by using the following connection string.

    Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=myPath\myData.sdf;SSCE:Max Buffer Size=1024;
     
     

    Encryption enabled

    Use this connection string to enable encryption on the database.

    Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=myPath\myData.sdf;SSCE:Encrypt Database=True;
     
     

    Specifying the maximum temp file size

    The maximum size of the temporary database file is by default 128 MB. Override this by using the following connection string.

    Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=myPath\myData.sdf;SSCE:Temp File Max Size=256;
     
     

    Specifying location of temp file

    Set the directory for the temp file location using this connection string.

    Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=myPath\myData.sdf;SSCE:Temp File Directory="\myTempDir\";
     
     

    Supplying the database password

    Use this connection string to provide the database password when opening the connection.

    Provider=Microsoft.SQLSERVER.MOBILE.OLEDB.3.0;Data Source=myPath\myData.sdf;SSCE:Database Password='myPassword';
     
     

    .NET Framework Data Provider for OLE DB

    Type .NET Framework Wrapper Class Library
    Usage System.Data.OleDb.OleDbConnection
    Manufacturer Microsoft

    Bridging to Microsoft.SQLSERVER.CE.OLEDB.3.5

    This is just one connection string sample for the wrapping OleDbConnection class that calls the underlying OLEDB provider. See respective OLE DB provider for more connection strings to use with this class.

    Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=myPath\myData.sdf;
     
     
  • 相关阅读:
    1 Quartz开始
    1 WCF 一个基础理论 以及如何实现一个简单wcf服务
    计时器timer的使用
    获取当前电脑的cpu使用率、内存使用率
    在asp.net core中使用cookie认证
    在.net core项目中想使用类似iis上面虚拟目录的功能
    有这样一个URL:http://item.taobao.com/item.htm?a=1&b=2&c=&d=xxx&e,请写一段JS程序提取URL中的各个GET参数(参数名和参数个数不确定),将其按key-value形式返回到一个json结构中,如{a:’1′, b:’2′, c:”, d:’xxx’, e:undefined}。
    输出今天的日期,以YYYY-MM-DD的方式,比如今天是2014年9月26日,则输出2014-09-26
    window.onload 和document ready的区别
    call和apply的区别
  • 原文地址:https://www.cnblogs.com/vinnie520/p/2373316.html
Copyright © 2011-2022 走看看