<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx</link><description>In most cases you'll want to create your database and it's schema as part of your applications first deployment. Depending on the scenario, you may create it on the client, or create it on the server, do the initial sync, then stream the file down to</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#1997671</link><pubDate>Sat, 31 Mar 2007 07:38:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1997671</guid><dc:creator>Aaron</dc:creator><description>&lt;P&gt;yeah, but does that really differ then the tack you would take for deploying any other sql flavor?&lt;/P&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#1998029</link><pubDate>Sat, 31 Mar 2007 09:28:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1998029</guid><dc:creator>Steve.Lasker</dc:creator><description>&lt;p&gt;Hi Aaron, I was just focusing on the simplicity of checking and creating the datafile. &amp;nbsp;You're correct. &amp;nbsp;Once the database is verified and created, there isn't much difference. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Steve&lt;/p&gt;
</description></item><item><title>Now Why Didn't I think of That</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#2008099</link><pubDate>Mon, 02 Apr 2007 01:54:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2008099</guid><dc:creator>Nick Randolph's .NET Travels</dc:creator><description>&lt;p&gt;I was just reading a post by Steve Lasker in which he describes how you can create a SQL Server Compact&lt;/p&gt;
</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#2010190</link><pubDate>Mon, 02 Apr 2007 09:35:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2010190</guid><dc:creator>Ed</dc:creator><description>&lt;P&gt;Steve,&lt;/P&gt;
&lt;P&gt;I went through the same issue prior to our mobile app being released late last year and pretty much did the same thing (although we relied on updating clients from a .net DataTable schema pushed down via web services).&lt;/P&gt;
&lt;P&gt;Anyway just a short tip for everyone that may help. Note that data types aren't identical for SQL Server and Compact, (i.e. DECIMAL is NUMERIC in Compact), so if the sql script works perfectly for all other editions of SQL, and mysteriously doesn't for Compact, it's likely a data type issue.&lt;/P&gt;
&lt;P&gt;Hope this helps...&lt;/P&gt;
&lt;P&gt;Ed&lt;/P&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#2015822</link><pubDate>Tue, 03 Apr 2007 07:33:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2015822</guid><dc:creator>Steve.Lasker</dc:creator><description>&lt;p&gt;Hi Ed,&lt;/p&gt;
&lt;p&gt;Yes, there are a subset of datatypes on Compact. &amp;nbsp;XML maps to nText, VarChar maps to nVarChar, etc. &amp;nbsp;Eventually, I'd really like raise the bar all together and just work with String, Int, Bool, but that's a bit out. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Steve&lt;/p&gt;
</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#2027774</link><pubDate>Thu, 05 Apr 2007 01:53:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2027774</guid><dc:creator>Cameron</dc:creator><description>&lt;P&gt;Hi Steve,&lt;/P&gt;
&lt;P&gt;Thanks for the post it works beautifully. I work in c# so I had to port it over, but other than that it gives me peace of mind and I don't have to worry about clickonce data files now that the db is a simple resource of my .dll&lt;/P&gt;
&lt;P&gt;Thanks again,&lt;/P&gt;
&lt;P&gt;-Cameron&lt;/P&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#2333806</link><pubDate>Mon, 30 Apr 2007 05:55:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2333806</guid><dc:creator>jjcorra</dc:creator><description>&lt;p&gt;I tried to follow your example, but at the engine.CreateDatabase() I get the error: &lt;/p&gt;
&lt;p&gt;&amp;quot;The file name is not valid. Check the file name for the database. [ File name = |DataDirectory|\MyDbFile.sdf ]&lt;/p&gt;
&lt;p&gt;The connection string in my app.config is &lt;/p&gt;
&lt;p&gt;&amp;lt;connectionStrings&amp;gt;&lt;/p&gt;
&lt;p&gt;	&amp;lt;add connectionString=&amp;quot;Data Source = '|DataDirectory|\MyDbFile.sdf'&amp;quot; name=&amp;quot;Default&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/connectionStrings&amp;gt;&lt;/p&gt;
&lt;p&gt;It doesn't look like |DataDirectory| is resolving correctly in the constructor for the SqlCeEngine class. But using the same connection string with an SqlCeConnection, the Database property of the SqlCeConnection returns &amp;quot;.\MyDbFile.sdf&amp;quot;&lt;/p&gt;
</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#2335721</link><pubDate>Mon, 30 Apr 2007 09:38:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2335721</guid><dc:creator>Brian Squibb</dc:creator><description>&lt;P&gt;Steve,&lt;/P&gt;
&lt;P&gt;I think more work is needed on the SUB CreateInitialDatabaseObjects as splitting on "GO" will create problems. Perhaps " GO " would be better.&lt;/P&gt;
&lt;P&gt;Brian&lt;/P&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#2465331</link><pubDate>Mon, 07 May 2007 19:37:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2465331</guid><dc:creator>Tejana</dc:creator><description>&lt;P&gt;Steve, &lt;/P&gt;
&lt;P&gt;I did not understand the line:&lt;/P&gt;
&lt;P&gt;a() &amp;nbsp; &amp;nbsp; &amp;nbsp;' make sure we put the connection back to its previous state&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#2603633</link><pubDate>Sun, 13 May 2007 20:22:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2603633</guid><dc:creator>Steve.Lasker</dc:creator><description>&lt;p&gt;Hi Joel,&lt;/p&gt;
&lt;p&gt;If you’re not resolving the |DataDirectory| it’s either because you’re running on devices, where |DataDirectory| isn’t supported, or you don’t actually have SQLce 3.1 installed. &amp;nbsp;Even after installing VS 2005 SP1, you don’t actually have SQLce 3.1 installed, you simply have the entry name updated from SQL Mobile to SQL Server Compact Edition. &amp;nbsp;To install SQLce 3.1, please visit:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.microsoft.com/sql/editions/compact/downloads.mspx"&gt;http://www.microsoft.com/sql/editions/compact/downloads.mspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Then hit the link for: &lt;/p&gt;
&lt;p&gt;Download the SQL Server 2005 Compact Edition Runtime Engine&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://go.microsoft.com/fwlink/?LinkID=79611"&gt;http://go.microsoft.com/fwlink/?LinkID=79611&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This gives you the &amp;lt;2mb engine.&lt;/p&gt;
&lt;p&gt;To get the updated tools, look for:&lt;/p&gt;
&lt;p&gt;SQL Server 2005 Compact Edition Tools for Visual Studio 2005 Service Pack 1&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=877C0ADC-0347-4A47-B842-58FB71D159AC&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyId=877C0ADC-0347-4A47-B842-58FB71D159AC&amp;amp;displaylang=en&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;That should take care of the updates&lt;/p&gt;
&lt;p&gt;Steve&lt;/p&gt;
</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#2603685</link><pubDate>Sun, 13 May 2007 20:24:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2603685</guid><dc:creator>Steve.Lasker</dc:creator><description>&lt;p&gt;Hi Brian,&lt;/p&gt;
&lt;p&gt;Yes, you’re point about parsing just GO wouldn’t be robust enough. &amp;nbsp;Good catch. &amp;nbsp;It should take into consideration NewLineGoEndOfLine so words like “ongoing” don’t get split.&lt;/p&gt;
&lt;p&gt;Another reason why you shouldn’t take anything for granted, even info in blogs &amp;lt;g&amp;gt;&lt;/p&gt;
&lt;p&gt;Steve&lt;/p&gt;
</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#2603735</link><pubDate>Sun, 13 May 2007 20:27:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2603735</guid><dc:creator>Steve.Lasker</dc:creator><description>&lt;p&gt;Hi Tejena,&lt;/p&gt;
&lt;p&gt;Yeah, I'm not sure what a() originally was. &amp;nbsp;Something got eaten in the paste from code. &amp;nbsp;In more robust code, I usually do a try/finally block where I save the original state of the connection, then put it back. &amp;nbsp;For instance some apps may have a common connection around but keeps it closed. &amp;nbsp;For each operation it needs to be opened, so it must be closed again. &amp;nbsp;However, for a loop of continual operations, it may already be open, so in that case, it should be left open.&lt;/p&gt;
&lt;p&gt;Steve&lt;/p&gt;
</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#3447538</link><pubDate>Thu, 21 Jun 2007 23:09:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3447538</guid><dc:creator>Neil Lamka</dc:creator><description>&lt;P&gt;I am using SqlCE and have created a DB that I'd like to "script" (use as a template) so that the DB can be created/recreated at run time if necessary.&lt;/P&gt;
&lt;P&gt;With MS SQL Server Management Studio Express when working with the SqlCE DB I don't find any way to create a script. &amp;nbsp;Am I missing something or do I need to create the DB in SQLExpress or something, script that and then use that in my SqlCE application?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Neil&lt;/P&gt;</description></item><item><title>如何将数据导入到 SQL Server Compact Edition 数据库中</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#4115477</link><pubDate>Sun, 29 Jul 2007 11:14:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4115477</guid><dc:creator>黎波</dc:creator><description>&lt;p&gt;在智能设备（Smart Device）应用程序和智能客户端（Smart Client）应用程序的部署阶段，我们需要对离线数据进行初始化，即将后台数据库服务器中的一些数据，导入到离线数据库中。本文介绍了一种将各种数据库中的数据到如到 SQL Server Compact Edition 数据库中的方法。&lt;/p&gt;
</description></item><item><title>如何将数据导入到 SQL Server Compact Edition 数据库中</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#4115516</link><pubDate>Sun, 29 Jul 2007 11:19:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4115516</guid><dc:creator>黎波</dc:creator><description>&lt;p&gt;在智能设备（Smart Device）应用程序和智能客户端（Smart Client）应用程序的部署阶段，我们需要对离线数据进行初始化，即将后台数据库服务器中的一些数据，导入到离线数据库中。本文介绍了一种将各种数据库中的数据导入到 SQL Server Compact Edition 数据库中的方法。&lt;/p&gt;
</description></item><item><title>如何将数据导入到 SQL Server Compact Edition 数据库中 </title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#4115599</link><pubDate>Sun, 29 Jul 2007 11:32:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4115599</guid><dc:creator>黎波</dc:creator><description>&lt;p&gt;在智能设备（Smart Device）应用程序和智能客户端（Smart Client）应用程序的部署阶段，我们需要对离线数据进行初始化，即将后台数据库服务器中的一些数据，导入到离线数据库中。本文介绍了一种将各种数据库中的数据导入到 SQL Server Compact Edition 数据库中的方法。&lt;/p&gt;
</description></item><item><title>如何将数据导入到 SQL Server Compact Edition 数据库中？</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#4117598</link><pubDate>Sun, 29 Jul 2007 16:18:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4117598</guid><dc:creator>勤勤同学</dc:creator><description>&lt;p&gt;如何将数据导入到 SQL Server Compact Edition 数据库中&lt;/p&gt;
</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#4370898</link><pubDate>Mon, 13 Aug 2007 21:47:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4370898</guid><dc:creator>jfj</dc:creator><description>&lt;p&gt;Is it possible to create a stored procedure in SQL CE? &lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#4671486</link><pubDate>Fri, 31 Aug 2007 19:21:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4671486</guid><dc:creator>Hanze</dc:creator><description>&lt;p&gt;1,000,000 Thank you!!!!!&lt;/p&gt;
&lt;p&gt;You saved my life. Your article is very useful for smart client developer.&lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#5369195</link><pubDate>Mon, 08 Oct 2007 21:11:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5369195</guid><dc:creator>Troy</dc:creator><description>&lt;P&gt;This is a very good article, however, I think it would make more sense to have the scripts run as part of the installation rather than part of the app. Once the user's database is up-to-date (when installed or upgraded), why would I want to check for the existence of the database and rerun the alter script every time the application is run? It seems to me that a &amp;nbsp;separate executable that runs your create/update code should be executed only during an installation or upgrade. Is this possible and does this make sense to you?&lt;/P&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#5467087</link><pubDate>Tue, 16 Oct 2007 07:19:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5467087</guid><dc:creator>Steve.Lasker</dc:creator><description>&lt;p&gt;Hi Troy,&lt;/p&gt;
&lt;p&gt;Yes, the same concepts could be run at install as well. &amp;nbsp;The challenges are sometimes end users delete files. &amp;nbsp;So, this is sort of a health check scenario. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Steve&lt;/p&gt;
</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#5494312</link><pubDate>Wed, 17 Oct 2007 19:01:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5494312</guid><dc:creator>Dan Miser</dc:creator><description>&lt;p&gt;I agree with Neil above. We need a way to script out the schema for an existing SDF file. It would make the most sense to have it in MSSQL Management Studio, but those options don't exist when connecting to an SDF file.&lt;/p&gt;
&lt;p&gt;Any ETA on when that feature will be available?&lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#5775715</link><pubDate>Tue, 30 Oct 2007 06:40:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5775715</guid><dc:creator>Steve.Lasker</dc:creator><description>&lt;p&gt;We’re working on a migration tool that will enable scripting. &amp;nbsp;We want to get this functionality into VS as well as Management Studio, but we just couldn’t get it done for the ’08 release. &amp;nbsp;It might be something we could do as a VS Extension, but the current migration tool will be stand alone for now.&lt;/p&gt;
&lt;p&gt;Steve&lt;/p&gt;
</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#6743445</link><pubDate>Wed, 12 Dec 2007 10:19:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6743445</guid><dc:creator>zmark</dc:creator><description>&lt;p&gt;Is there any way to use SQL Server Compact Edition 3.5 in VB6? I tried with ADO and connection string had from MS site .. but I keep getting Runtime 3706 - Provider not found. &lt;/p&gt;
</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#6774167</link><pubDate>Sat, 15 Dec 2007 05:08:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6774167</guid><dc:creator>Steve.Lasker</dc:creator><description>&lt;p&gt;We really don't have a full OleDB implementation that most expect on desktop. &amp;nbsp;Our OleDB implementation was done for devices which is a fairly small subset. &amp;nbsp;For instance, there's no RecordSet. So, you can use it with limited usage scenarios, but it's unfortunately not something we're looking to expand upon at this time.&lt;/p&gt;
&lt;p&gt;Sitaram posted this info a while back that explains what we do have available: &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/sqlservercompact/archive/2007/01/13/windows-2000-support.aspx"&gt;http://blogs.msdn.com/sqlservercompact/archive/2007/01/13/windows-2000-support.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Steve&lt;/p&gt;
</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#6893154</link><pubDate>Sat, 29 Dec 2007 08:52:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6893154</guid><dc:creator>John Hamilton</dc:creator><description>&lt;p&gt;Regarding scripting. &amp;nbsp;Design the DB in SQL Express then Generate the Script and run it against SQLCE and place it in your application for use during a create/upgrade.&lt;/p&gt;</description></item><item><title>如何将数据导入到 SQL Server Compact Edition 数据库中</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#7037219</link><pubDate>Wed, 09 Jan 2008 09:38:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7037219</guid><dc:creator>derryzhang</dc:creator><description>&lt;p&gt;如何将数据导入到 SQL Server Compact Edition 数据库中&lt;/p&gt;
</description></item><item><title>DML Problem</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#7141585</link><pubDate>Thu, 17 Jan 2008 16:01:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7141585</guid><dc:creator>Raj</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have problem while data insertion in sql ce via vs2005 for mobile sdk 6.&lt;/p&gt;
&lt;p&gt;No error code do well but no effect noi data in database.&lt;/p&gt;
&lt;p&gt;If you can please send me at sandlohana@hotmail.com&lt;/p&gt;
&lt;p&gt;CODE HERE&lt;/p&gt;
&lt;p&gt;cnSQL = New SqlCeConnection(ConnectionString)&lt;/p&gt;
&lt;p&gt;cnSQL.Open()&lt;/p&gt;
&lt;p&gt;Dim cmd As SqlCeCommand = cnSQL.CreateCommand()&lt;/p&gt;
&lt;p&gt;cmd.CommandText = &amp;quot;INSERT INTO dP(Date1) Values(100)&amp;quot;&lt;/p&gt;
&lt;p&gt;ra = cmd.ExecuteNonQuery()&lt;/p&gt;
&lt;p&gt;Other way&lt;/p&gt;
&lt;p&gt;Dim myCommand As SqlCeCommand&lt;/p&gt;
&lt;p&gt;myCommand = New SqlCeCommand(&amp;quot;INSERT INTO dP(Date1) Values(200)&amp;quot;)&lt;/p&gt;
&lt;p&gt;myCommand.Connection = cnSQL&lt;/p&gt;
&lt;p&gt;ra = myCommand.ExecuteNonQuery()&lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#7400579</link><pubDate>Sun, 03 Feb 2008 01:54:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7400579</guid><dc:creator>Carlos</dc:creator><description>&lt;p&gt;I was able to see among the data sources within Visual Studio 2005 the SQL server compact edition provider. I did install, and the data source disappeared. Then, I removed v3.5, and attempted to install the version that updates VS2005 SP1, and it did not let me. Now, I am able to connect thru SQL server anagement studio to that provider, but not thru VS 2005.&lt;/p&gt;
&lt;p&gt;Can you please help?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Carlos.&lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#7403411</link><pubDate>Sun, 03 Feb 2008 06:01:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7403411</guid><dc:creator>Steve.Lasker</dc:creator><description>&lt;p&gt;Hi Carlos, please see these steps for configuring SQLce 3.1 with VS 2005. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/stevelasker/archive/2007/08/07/configuring-visual-studio-2005-for-use-wtih-sql-server-2005-compact-edition.aspx"&gt;http://blogs.msdn.com/stevelasker/archive/2007/08/07/configuring-visual-studio-2005-for-use-wtih-sql-server-2005-compact-edition.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For SQLce 3.5, you can use it with code, but the designers in VS 2005 will not work with SQLce 3.5. &amp;nbsp;Likewise, the designers in VS 2008 will not work with SQLce 3.1.&lt;/p&gt;
&lt;p&gt;Steve&lt;/p&gt;
</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#7419457</link><pubDate>Mon, 04 Feb 2008 00:22:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7419457</guid><dc:creator>Carlos</dc:creator><description>&lt;p&gt;Steve, thank you for posting your reply so &lt;/p&gt;
&lt;p&gt;fast. In fact what I did find is that by just &lt;/p&gt;
&lt;p&gt;re-installing the sql server mobile from the&lt;/p&gt;
&lt;p&gt;VS2005 installation disk (i.e. residing under the wcu\sqlce directory), and then&lt;/p&gt;
&lt;p&gt;re-installing the sql server compact edition (v3.1), the VS2005 environment was able to recover the SQL server compact among the list of&lt;/p&gt;
&lt;p&gt;data providers.&lt;/p&gt;</description></item><item><title>如何将数据导入到 SQL Server Compact Edition 数据库中（一） </title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#7611910</link><pubDate>Mon, 11 Feb 2008 17:23:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7611910</guid><dc:creator>婕舞飞扬</dc:creator><description>&lt;p&gt;黎波MobileBusinessSolution&lt;/p&gt;
&lt;p&gt;一、场景描述在智能设备（SmartDevice）应用程序和智能客户端（SmartClient）应用程序的部署阶段，我们需要对离线数据进行初...&lt;/p&gt;
</description></item><item><title>如何将数据导入到 SQL Server Compact Edition 数据库中</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#7690738</link><pubDate>Thu, 14 Feb 2008 14:51:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7690738</guid><dc:creator>xiangxiangouhongyuan</dc:creator><description>&lt;p&gt;如何将数据导入到 SQL Server Compact Edition 数据库中（一）&lt;/p&gt;
</description></item><item><title>如何将数据导入到 SQL Server Compact Edition 数据库中 </title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#7997003</link><pubDate>Mon, 03 Mar 2008 10:25:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7997003</guid><dc:creator>懒羊</dc:creator><description>&lt;p&gt;懒羊语：近来一直在研究学习wm5,主要原因公司近期可能与此相关有一个项目要进行，从了解最基本的通过donet还是evc，到后来的界面编程，再到后来的数据库，而这篇算是让我两脚的前一半脚趾进入数据库的开始，强烈的推荐这篇文章，转载这篇文章一是给需要的朋友看看，更是给自己留下一个看的地方。&lt;/p&gt;
</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#8410177</link><pubDate>Sat, 19 Apr 2008 16:48:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8410177</guid><dc:creator>Koh</dc:creator><description>&lt;p&gt;How to programmatically convert non-encrypted database to encrypted and add password to it, also how to change password after that?&lt;/p&gt;
&lt;p&gt;thanks.&lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#8410186</link><pubDate>Sat, 19 Apr 2008 17:13:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8410186</guid><dc:creator>Koh</dc:creator><description>&lt;p&gt;i have found the answer, use System.Data.SqlServerCe.SqlCeEngine Compact method.&lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#8424187</link><pubDate>Fri, 25 Apr 2008 17:56:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8424187</guid><dc:creator>Simon Hart</dc:creator><description>&lt;p&gt;Great article, the only thing to watch out for is if there are any columns, tables etc named GO or has 'GO' in them, you'll have problems. Best to read into a TextReader then check each line for the word &amp;quot;GO&amp;quot;.&lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#8440894</link><pubDate>Wed, 30 Apr 2008 06:05:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8440894</guid><dc:creator>Steve.Lasker</dc:creator><description>&lt;p&gt;Good catch Simon,&lt;/p&gt;
&lt;p&gt;I've updated the sample. &amp;nbsp;There are several updates, including checking for CR + LF. &amp;nbsp;Which still isn't perfect as you could have GO without the comma after it, but it's what I've got so far...&lt;/p&gt;
&lt;p&gt;I've also updated the scripts to use transactions. &amp;nbsp;I'll write an article explaining this, but in the meantime: &lt;a rel="nofollow" target="_new" href="http://steve.lasker.members.winisp.net//Demos//SQLce35//CreatingDatabaseSchemaInCode.zip"&gt;http://steve.lasker.members.winisp.net//Demos//SQLce35//CreatingDatabaseSchemaInCode.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Steve&lt;/p&gt;
</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#8463688</link><pubDate>Tue, 06 May 2008 22:03:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8463688</guid><dc:creator>BillH</dc:creator><description>&lt;p&gt;I am developing a standalone product that ships with a database that has a lot of reference data in it. The product may or may not ever connect to a server. &amp;nbsp;The product was started when SQL Mobile was current.&lt;/p&gt;
&lt;p&gt;1) How can I convert my SQL Mobile database to SQL Compact Edition 3.1?&lt;/p&gt;
&lt;p&gt;2) What can I use to edit the structure of the database? &amp;nbsp;In Visual Studio 2005 I can make some changes but not change column names, etc.&lt;/p&gt;
&lt;p&gt;3) Currently the systems are created by simply including the base database file in the appropriate folder. &amp;nbsp;It sounds like this might have issues, but so far we haven't seen any.&lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#8487866</link><pubDate>Sun, 11 May 2008 19:48:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8487866</guid><dc:creator>Steve.Lasker</dc:creator><description>&lt;P&gt;Hi Bill,&lt;/P&gt;
&lt;P&gt;1 Converting from SQL Mobile to Compact 3.1 – Actually, there’s nothing to do to the database as 3.1 is really a “service pack” for 3.0 so no file format changes were needed. &amp;nbsp;To reflect the expanded usage on desktops, we changed the name, since we couldn’t really have a newly named product have the same and version, or somehow call it a service pack. &amp;nbsp;It’s all very confusing we realize, but it is what it is… &lt;/P&gt;
&lt;P&gt;To move from 3.0 to 3.1, simply reference the Compact 3.1 dlls. &amp;nbsp;They’ll say System.Data.SqlServerCe, as opposed to SQL Mobile, or something similar.&lt;/P&gt;
&lt;P&gt;When/if you move from 3.0/3.1 to 3.5, we do have a file format change, but we have a simple API, SqlCeEngine.Upgrade() to do the conversion directly on the users machine.&lt;/P&gt;
&lt;P&gt;2 Schema Changes – yeah, unfortunately you can’t actually change the name of a column. &amp;nbsp;We know this is a pain point, and something we’ll be fixing in our next release. &amp;nbsp;We hoped to get it done in this release, but it simply fell off the radar- lame I know. You can of course add a new column with the right name, do an update to the same table to move the data over, and then delete the old column.&lt;/P&gt;
&lt;P&gt;3 If the data is only read-only, and can never be changed by the user, it’s not so bad. &amp;nbsp;The problem is when you want to update the app and the database has user data, you can’t just replace the database. &amp;nbsp;If your “updates” have minimal changes to the local database, it may be more efficient to simply add a table, row, column through script changes, as opposed to replacing the entire database.&lt;/P&gt;
&lt;P&gt;Hope that helps,&lt;/P&gt;
&lt;P&gt;Steve&lt;/P&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#8500494</link><pubDate>Tue, 13 May 2008 18:06:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8500494</guid><dc:creator>Jonny Walker</dc:creator><description>&lt;p&gt;So, how many of those 3 database connections - the initial for testing, the second for populating and the implied third for using - do you *have* to create? &amp;nbsp;I can imagine that the first one may be invalid if the file is not present at that point, but I would have thought for the sake of efficiency (and sanity) it would be better for the procedure creating the DB to instead be a function returning the connection.&lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#8501153</link><pubDate>Tue, 13 May 2008 21:30:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8501153</guid><dc:creator>Steve.Lasker</dc:creator><description>&lt;P&gt;I'm working on a newer sample I'll be showing at Tech Ed that does better encapsulation, and includes encryption, versioning and transaction support. &amp;nbsp;An early view of an updated sample is &lt;A class="" href="http://steve.lasker.members.winisp.net/Demos/SQLce35/CreatingDatabaseSchemaInCode.zip"&gt;here&lt;/A&gt;: &lt;/P&gt;
&lt;P&gt;Steve&lt;/P&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#8502908</link><pubDate>Wed, 14 May 2008 11:22:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8502908</guid><dc:creator>Jonny Walker</dc:creator><description>&lt;p&gt;Other than some minor concerns about the efficiency and possibly having your schema documented in SQL in your delivered code, I like this approach.&lt;/p&gt;
&lt;p&gt;SQL schema versioning is generally a complete pain, and extending this technique you can add version n - n+1 update scripts to your health check. &amp;nbsp;Another thing you can do here that you can't do with other techniques that I've seen is have a local password for your DB file - i.e. the application generates the password, which is different per installation. &amp;nbsp;If you deploy an SDF there's no easy way (that I've found) of re-passwording it to a local password. &amp;nbsp;(And, as before, there's also no way to 'deploy' schema updates like this.)&lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#8503737</link><pubDate>Wed, 14 May 2008 20:34:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8503737</guid><dc:creator>Steve.Lasker</dc:creator><description>&lt;P&gt;Hi Jonny,&lt;/P&gt;
&lt;P&gt;I’m not sure about your “efficiency” concern. &amp;nbsp;Are you worried about developer efficiency? &amp;nbsp;Or runtime efficiency? &amp;nbsp;Form a developer efficiency, I agree we need better tools here, and something we’re looking to do in our next release, 4.0. &amp;nbsp;For runtime efficiency, this tends to be the best model, particularly when your users have already changed data in the local file. &amp;nbsp;It’s actually more efficient to issue an “ALTER TABLE Customer ADD COLUMN AddressLine3…” than to ship a new database, and have to do a local data migration from one file to another.&lt;/P&gt;
&lt;P&gt;For the n+1 versioning, yup, that’s the idea. &amp;nbsp;By “versioning” your local database schema, developers can chose how many previous versions they wish to support. &amp;nbsp;You could even skip versions rather than forcing someone who’s current on V1 and needs to get to V3 from having to upgrade to V2 first, than upgrade to V3 again.&lt;/P&gt;
&lt;P&gt;For the local passwords, yup, that’s another topic of great discussion. &amp;nbsp;In the sample &lt;A class="" href="http://steve.lasker.members.winisp.net/Demos/SQLce35/CreatingDatabaseSchemaInCode.zip"&gt;here&lt;/A&gt;, I’ve used Guid.NewGuid() as a simple way to get unique passwords per user install. &amp;nbsp;Of course this could be more elaborate, but you likely don’t want to use the same password on each users machine or cracking one machine will allow you to just walk up to another machine. &amp;nbsp;However, this methodology would also break the “doc centric” format where you want to ship the “document” from one user to another. &amp;nbsp;If each user has their own password, the recipient won’t be able to open the database. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;For repasswording an sdf, you can use the SqlCeEngine.Compact() api. &amp;nbsp;We essentially create a new database. &amp;nbsp;If you specify a different set of connection string name/value pairs, including the password, you can change the password. &lt;/P&gt;
&lt;P&gt;Hope that answers your questions,&lt;/P&gt;
&lt;P&gt;Steve&lt;/P&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#8524029</link><pubDate>Tue, 20 May 2008 20:37:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8524029</guid><dc:creator>Will</dc:creator><description>&lt;p&gt;Thanks for the example on how to check the database is created or not. However, I wonder is there a way to go further in and check whether the tables are created if the database exists?&lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#8708447</link><pubDate>Tue, 08 Jul 2008 17:32:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8708447</guid><dc:creator>rajiv</dc:creator><description>&lt;p&gt;hi&lt;/p&gt;
&lt;p&gt;Its a very helpful article. &lt;/p&gt;
&lt;p&gt;Since I read that SMO and SqlCe dont go together, I am not sure on how to proceed on my problem.&lt;/p&gt;
&lt;p&gt;I have a data table from a different source(may be text file). Everytime the schema is going to be different for data table. Since I cannot use SMO to copy the schema into SqlCe , how do I do it??&lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#8712523</link><pubDate>Wed, 09 Jul 2008 16:19:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8712523</guid><dc:creator>Raviraj</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am trying to create a table with following command in SQL CE 3.5 -&lt;/p&gt;
&lt;p&gt;CREATE TABLE dbo.AuthInspectionFacility_InspectionRegimeCode(&lt;/p&gt;
&lt;p&gt;	InspectionRegimeCode char(1) NOT NULL,&lt;/p&gt;
&lt;p&gt;	InspectionRegimeShortDescription varchar(30) NULL,&lt;/p&gt;
&lt;p&gt;	InspectionRegimeLongDescription varchar(50) NULL,&lt;/p&gt;
&lt;p&gt;	SortKey tinyint NULL,&lt;/p&gt;
&lt;p&gt; CONSTRAINT PK_AuthInspectionRegimeCode PRIMARY KEY CLUSTERED &lt;/p&gt;
&lt;p&gt;(&lt;/p&gt;
&lt;p&gt;	InspectionRegimeCode ASC&lt;/p&gt;
&lt;p&gt;)WITH (PAD_INDEX &amp;nbsp;= OFF, IGNORE_DUP_KEY = OFF) ON PRIMARY&lt;/p&gt;
&lt;p&gt;) ON PRIMARY&lt;/p&gt;
&lt;p&gt;GO&lt;/p&gt;
&lt;p&gt;I get error as -&lt;/p&gt;
&lt;p&gt;A first chance exception of type 'System.Data.SqlServerCe.SqlCeException' occurred in System.Data.SqlServerCe.dll&lt;/p&gt;
&lt;p&gt;Additional information: The table name is not valid. [ Token line number (if known) = 1,Token line offset (if known) = 18,Table name = AuthInspectionFacility_InspectionRegimeCode ]&lt;/p&gt;
&lt;p&gt;How to fix this error?&lt;/p&gt;
&lt;p&gt;Ravi&lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#8713801</link><pubDate>Wed, 09 Jul 2008 23:50:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8713801</guid><dc:creator>Steve.Lasker</dc:creator><description>&lt;p&gt;Hi Will,&lt;/p&gt;
&lt;p&gt;Sure, you can simply query some of the system views:&lt;/p&gt;
&lt;p&gt;SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Employees'&lt;/p&gt;
&lt;p&gt;There are additional tables for columns, indexes, etc. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Steve&lt;/p&gt;
</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#8713828</link><pubDate>Wed, 09 Jul 2008 23:54:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8713828</guid><dc:creator>Steve.Lasker</dc:creator><description>&lt;p&gt;Hi Raviv&lt;/p&gt;
&lt;p&gt;I’m not sure I understand your question. &amp;nbsp;Are you looking for a method for creating the schema of a table? &amp;nbsp;SMO provides this functionality for SQL Server, but you could also achieve the same results with CREATE TABLE …&lt;/p&gt;
&lt;p&gt;Or, are you saying you have a System.Data.DataTable (DataSet) that you want to infer the schema from to create the equivalent Compact table?&lt;/p&gt;
&lt;p&gt;Steve&lt;/p&gt;
</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#8721708</link><pubDate>Fri, 11 Jul 2008 20:10:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8721708</guid><dc:creator>Josh</dc:creator><description>&lt;p&gt;Yes, this is what I need to find out:&lt;/p&gt;
&lt;p&gt;&amp;quot;...are you saying you have a System.Data.DataTable (DataSet) that you want to infer the schema from to create the equivalent Compact table?&amp;quot;&lt;/p&gt;
&lt;p&gt;I have some DataTables or DataSets that I need to somehow create individual SQLCE Tables at runtime, since I do not know in advance how many columns or datatypes.&lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#8721791</link><pubDate>Fri, 11 Jul 2008 21:09:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8721791</guid><dc:creator>socrboy</dc:creator><description>&lt;p&gt;I don't know if you received the last post, as I was not signed in; but this is what I wanted to know if you could help me: &amp;quot;...are you saying you have a System.Data.DataTable (DataSet) that you want to infer the schema from to create the equivalent Compact table?&amp;quot;&lt;/p&gt;
&lt;p&gt;Yes, I have various DataTables/DataSets that I would like to import into SQLCE as tables; also, I do not know what information the tables would have as far as number of columns or datatypes, since they will be generated at runtime.&lt;/p&gt;
&lt;p&gt;Any help in the right direction will be appreciated,&lt;/p&gt;
&lt;p&gt;Josh&lt;/p&gt;
</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#8731641</link><pubDate>Mon, 14 Jul 2008 18:41:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8731641</guid><dc:creator>Raviraj</dc:creator><description>&lt;p&gt;Hi Steve,&lt;/p&gt;
&lt;p&gt;Thank you for your quick reply. I figured out that SQL CE 3.5 does not support schema and my SQL text had schema in it.&lt;/p&gt;
&lt;p&gt;I am trying to migrate SQL Express database to SQL CE 3.5. So application is trying to create database from a script file (containing SQL). Though i have resolved some of the issues and managed to create SQL CE 3.5 database from this SQL script file i have some questions - &lt;/p&gt;
&lt;p&gt;1. I have a serious issue with &amp;quot;nocheck&amp;quot; construct. In SQL CE I find that this option is no more supported. Is there any way to disbale &amp;nbsp;this option (e.g. for bulk inserts)? &lt;/p&gt;
&lt;p&gt;2. How to create database script from SQL CE 3.5 database?&lt;/p&gt;
&lt;p&gt;Thanks and regards,&lt;/p&gt;
&lt;p&gt;Ravi&lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#8732441</link><pubDate>Tue, 15 Jul 2008 04:02:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8732441</guid><dc:creator>Steve.Lasker</dc:creator><description>&lt;p&gt;Hi Josh,&lt;/p&gt;
&lt;p&gt;We used similar concepts in Sync Services to gather the schema information from the DataSet based on the Max Length for variable length columns, CLR data types and nullability. &amp;nbsp;That said, we don’t have an API that can directly take a DataTable schema and do this ad-hoc. &amp;nbsp;It would be an interesting community sample …&lt;/p&gt;
&lt;p&gt;Steve&lt;/p&gt;
</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#8922032</link><pubDate>Wed, 03 Sep 2008 17:41:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8922032</guid><dc:creator>Paul C.</dc:creator><description>&lt;p&gt;Hello Steve. &amp;nbsp;Thanks for the write-up. &amp;nbsp;I am having an issue where my application ran just fine (in debug mode within VS2K5) and then stopped working with the dreaded &amp;quot;The file name is not valid. Check the file name for the database. &amp;nbsp;[ File name = |DataDirectory|\\myDatabase.sdf ]&amp;quot;&lt;/p&gt;
&lt;p&gt;Odd thing is that the .sdf file is indeed in the location (bin/debug in this case) that's also the same as the Application.StartupPath.&lt;/p&gt;
&lt;p&gt;I'm stumped as to how this could literally be working upon one running of the app from within VS2K5 and not working during the next run of the app.&lt;/p&gt;
&lt;p&gt;I made no changes to any of the code that has to do with the data access logic.&lt;/p&gt;
&lt;p&gt;Have you seen/heard of this issue?&lt;/p&gt;
&lt;p&gt;Thanks in advance.&lt;/p&gt;
&lt;p&gt;-Paul&lt;/p&gt;</description></item><item><title>[zt]如何将数据导入到 SQL Server Compact Edition 数据库中（一） </title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#9000242</link><pubDate>Wed, 15 Oct 2008 05:00:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9000242</guid><dc:creator>双霜之君</dc:creator><description>&lt;p&gt;一、场景描述&lt;/p&gt;
&lt;p&gt;在智能设备（SmartDevice）应用程序和智能客户端（SmartClient）应用程序的部署阶段，我们需要对离线数据进行初始化，即将后台数据库服务器中的一些数据，导入到离线数据...&lt;/p&gt;
</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#9001643</link><pubDate>Thu, 16 Oct 2008 12:40:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9001643</guid><dc:creator>SUNIL MEHTA</dc:creator><description>&lt;p&gt;very useful article. is there a way we can create the script for the file..&lt;/p&gt;
&lt;p&gt;Sunil Mehta&lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#9031934</link><pubDate>Mon, 03 Nov 2008 11:15:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9031934</guid><dc:creator>Nige</dc:creator><description>&lt;p&gt;Great stuff! I was struggling (like a fool) to create the bd without the db file being there so cheers for that.&lt;/p&gt;
&lt;p&gt;Its worth noting you can use VS 2005 by making a reference to C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Desktop\System.Data.SqlServerCe.dll. This way you can use .Net2.0 instead of having your clients install .Net3.5 which is a bad point of sale in my mind.&lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#9032149</link><pubDate>Mon, 03 Nov 2008 12:06:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9032149</guid><dc:creator>Nige</dc:creator><description>&lt;p&gt;Just to add: &lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/en-us/library/aa983326.aspx"&gt;http://msdn.microsoft.com/en-us/library/aa983326.aspx&lt;/a&gt; if trouble deploying :)&lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#9033494</link><pubDate>Mon, 03 Nov 2008 18:19:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9033494</guid><dc:creator>Steve.Lasker</dc:creator><description>&lt;p&gt;Hi Nige,&lt;/p&gt;
&lt;p&gt;Happy to hear this helped.&lt;/p&gt;
&lt;p&gt;For the FX dependencies, you're correct, Compact doesn't require .NET FX 3.0 or 3.5. &amp;nbsp;The engine is compiled against FX 2.0, so any FX version, 2.0, 3.0, 3.5, 3.5 (SP1), will work. &amp;nbsp;If you're using the ADO.NET Entity Framework, you'll need FX 3.5 SP1 as this is where the base Entity Framework first ships.&lt;/p&gt;
&lt;p&gt;Steve&lt;/p&gt;
</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#9033880</link><pubDate>Mon, 03 Nov 2008 19:57:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9033880</guid><dc:creator>Nige</dc:creator><description>&lt;p&gt;Hi, not using ADO.NET. I've added all the dlls to my deployment. Odd thing is I can't get compact to appear as a prerequisite on Click Once in VS2005 - maybe it dosnt do the &amp;nbsp;bootstrap for 2005. Shame cos its adding over 2 Meg to every update I do and I'm on 5.5 Meg as it is! Still I like onlt having .Net2.0 as a prereq as it causes a lot less bother when it comes to installation for the first time.&lt;/p&gt;
&lt;p&gt;Cheers again for getting me out of my little hole I was digging for myself, the compact sql commands are easy and simple - means more beer time 'pour moi' :)&lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#9127273</link><pubDate>Thu, 20 Nov 2008 06:56:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9127273</guid><dc:creator>Steve.Lasker</dc:creator><description>&lt;p&gt;Hi Nige,&lt;/p&gt;
&lt;p&gt;Here's some info on how to install Compact with VS 2005: &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/stevelasker/archive/2007/08/07/configuring-visual-studio-2005-for-use-wtih-sql-server-2005-compact-edition.aspx"&gt;http://blogs.msdn.com/stevelasker/archive/2007/08/07/configuring-visual-studio-2005-for-use-wtih-sql-server-2005-compact-edition.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Although, you're saying you're not using ADO.NET, but you mention .NET FX 2.0, so I'm a bit confused. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you're programming in .NET, you're using ADO.NET. &amp;nbsp;Unless, you're trying to use OleDB, which wouldn't work 'cause Compact doesn't have a full OleDB provider. &amp;nbsp;It was designed as a minimal api for devices.&lt;/p&gt;
&lt;p&gt;Anyway, the VS2005 link should help if you want the bootstrapper, but remember, it will require admin rights for your end users.&lt;/p&gt;
&lt;p&gt;Steve&lt;/p&gt;
</description></item><item><title>Great post, and here's T4 code to generate the script from an EDMX</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#9625570</link><pubDate>Mon, 18 May 2009 20:13:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9625570</guid><dc:creator>Hightechrider</dc:creator><description>&lt;p&gt;Steve,&lt;/p&gt;
&lt;p&gt;I see several other folks had issues with generating the script itself since Management Studio will not export it from an existing SQL Compact database.&lt;/p&gt;
&lt;p&gt;One solution to this is to generate the script from the Entity model. &amp;nbsp;The EDMX file itself doesn't have all the information you need (no hints as to what to index etc.) but it can do a reasonable job at generating the tables, primary keys and foreign keys.&lt;/p&gt;
&lt;p&gt;You can find a T4 script to do this on my blog. &amp;nbsp;Adding this script to a project will autogenerate a .sql file that can then be embedded as a resource.&lt;/p&gt;</description></item><item><title>re: Creating your SQL Server Compact Edition database and schema in code</title><link>http://blogs.msdn.com/stevelasker/archive/2007/03/31/creating-your-sql-server-compact-edition-database-and-schema-in-code.aspx#9632359</link><pubDate>Wed, 20 May 2009 18:29:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9632359</guid><dc:creator>Matthew Cole</dc:creator><description>&lt;p&gt;Hi there Steve!&lt;/p&gt;
&lt;p&gt;I wonder if you would help? I'm creating my sdf and populating it from web services (c#). I am getting the sdf created now but when I go to populate it I get:&lt;/p&gt;
&lt;p&gt;An error has occurred while establishing a connection to the server. &amp;nbsp;When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)&lt;/p&gt;
&lt;p&gt;My createSdf (creates file and tables+indexes) and insertData (a looped adapter.insert) are in two separate web service operations.&lt;/p&gt;
&lt;p&gt;I am using a SQL INSERT statement in a table adapter whose connection string I am setting before the adapter.insert loop.&lt;/p&gt;
&lt;p&gt;I have had this working on my workstation but it has now stopped with the error above and I can't see what to do. My web research has led me on a merry journey over several days and I'm now quite desperate! Am am fairly new to .Net and CF development (1 year).&lt;/p&gt;
&lt;p&gt;I hope you can help!&lt;/p&gt;
&lt;p&gt;Cheers, in advance.&lt;/p&gt;
&lt;p&gt;Matthew&lt;/p&gt;</description></item></channel></rss>