标签:sqlite string nload value csharp ems dispose connect cti
(1)下载SQLCE组件
https://www.microsoft.com/en-us/download/details.aspx?id=17876
(2)下载VS2013工具设计器
https://marketplace.visualstudio.com/items?itemName=ErikEJ.SQLServerCompactSQLiteToolbox
(3)用记事本建立一个空的文本文件。
(4)在View里选择“Server Explorer”,添加连接
(5)选择SQL Server Compace4.0
(6)建立sdf文件,例如放在 c:\db.sdf
(7)双击数据库
(8)右键,可以新建表。
(9)连接SQLCE
SqlCeEngine engine = new SqlCeEngine(connString); engine.CreateDatabase(); engine.Dispose(); SqlCeConnection conn = new SqlCeConnection(connString); conn.Open(); SqlCeCommand cmd = conn.CreateCommand(); cmd.CommandText = "CREATE TABLE BlobTable(name nvarchar(128), blob ntext);"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO BlobTable(name, blob) VALUES (@name, @blob);"; SqlCeParameter paramName = cmd.Parameters.Add("name", SqlDbType.NVarChar, 128); SqlCeParameter paramBlob = cmd.Parameters.Add("blob", SqlDbType.NText); paramName.Value = "Name1"; paramBlob.Value = "Name1".PadLeft(4001);
在Visual Studio 2013里使用 Microsoft SQL Server Compact Edition
标签:sqlite string nload value csharp ems dispose connect cti
原文地址:http://www.cnblogs.com/mqingqing123/p/7288880.html