sql-server-ce

Methods to migrate SQL Database (mdf) to SQL Compact Edition (sdf)

你。 提交于 2019-12-04 17:57:49
问题 I have 4 SQL Server 2005 db's that I want to move to SQL CE. I know I cannot keep the SProcs,Views, and Functions( Differences Between SQL Server Compact and SQL Server ) but I would like to keep everything else. I have tried this app, SQL Server to SQL Server Compact Edition Database Copy but it errors out on me. I have the source and am looking into it but I thought I'd check and make sure I wasn't over complicating the solution to my ACTUAL goal. Is there a simple, can be one shot, way of

Correct way to close database connection in event of exception

强颜欢笑 提交于 2019-12-04 17:38:31
问题 Does the following code leave the connection open if there is an exception? I am using a Microsoft SQL compact edition database. try { SqlCeConnection conn = new SqlCeConnection(ConnectionString); conn.Open(); using (SqlCeCommand cmd = new SqlCeCommand("SELECT stuff FROM SomeTable", conn)) { // do some stuff } conn.Close(); } catch (Exception ex) { ExceptionManager.HandleException(ex); } Surely a better way would be to declare a connection object before the try, establish a connection inside

LEFT OUTER JOIN with a WHERE clause

本小妞迷上赌 提交于 2019-12-04 15:44:52
问题 I have two tables. indRailType contains a list of the names paired with an ID value that I use in other tables to indicate the rail type. WO_BreakerRail contains a date column and a rail code column that corresponds to the same code in indRailType and some other data. There's a row in WO_BreakerRail for any activity on each rail type, for every date. So I could have 3 rows dated for 3/19/2010 , each row indicates a different rail code, and what happened. When I use the following LEFT OUTER

How to connect to SQL Server CE file using SSMS

懵懂的女人 提交于 2019-12-04 15:36:00
问题 I am using SSMS 2012 and trying to connect to the SDF created by Orchard. According to this answer, I should be able to select SQL Server Compact Edition as the Server type when connecting my object browser, but that isn't an option. Is there something I need to install? Did I miss part of the install originally (when setting up SSMS)? 回答1: SQL Server Compact is no longer supported in SSMS 2012, I have a list of available tools from Microsoft and others here: http://erikej.blogspot.dk/2009/04

How to deploy an SQL Compact Edition database file (.sdf) in the AppData folder? Connection string?

陌路散爱 提交于 2019-12-04 14:56:01
I'm planning to deploy my DB file in the Users\CurrentUserName\AppData folder, because default User Account Control settings restrict write access to the Program Files directory where my program is installed. First question - is this correct? So far, I've created a custom folder, set the DefaultLocation property to [LocalAppDataFolder][ProductName] , and put the .sdf file in that folder. This works in Windows 7, but it doesn't seem to work in Windows XP - I can't find any sign of it being deployed anywhere. So where and how should I deploy the DB file? I'm also unsure how to set the connection

Migrate from SQLCE 4 to SQL Server 2008

大憨熊 提交于 2019-12-04 13:07:05
So, being an early adopter, I have developed an application based on SQLCE4, ASP.Net MVC3 and Entity Framework CTP5 (code first) based on a fit of recklessness induced by reading this announcement . Now the application is moving into production and we need to lose the ce in favour of SQL Server 2008 and later azure. Scott Gu mentioned that tooling would be out soon to support such migrations but I wonder if we're too early to take advantage of an easy route. Anyone done it? Is there a simple migration path? Something like the MDF create script option in Visual Studio? Have you looked at SQL

Using EF Code First and SqlCe in WPF

杀马特。学长 韩版系。学妹 提交于 2019-12-04 12:30:18
问题 I'm trying to use EF Code First with my WPF application , the idea is to create a SqlCe Db in AppData/MyApp (if there isn't one) and use it with EF Code First. At the moment it's giving error when I try to read data off the database it supposed to create , but when I checked the db context object I saw it's trying to create it in SqlExpress. First of all , how can I set it to work with CE instead of SqlExpress and set the file location? I tried changing the connection string in app.config but

Does SQL Server CE support schema update with NHibernate?

萝らか妹 提交于 2019-12-04 12:05:27
SchemaExport seems to work, but SchemaUpdate fails - the SchemaUpdate.Exceptions contains this object: System.NotSupportedException: The method is not supported. in System.Data.Common.DbConnection.GetSchema(String collectionName, String[] restrictionValues) in NHibernate.Dialect.Schema.AbstractDataBaseSchema.GetTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) in NHibernate.Tool.hbm2ddl.DatabaseMetadata.GetTableMetadata(String name, String schema, String catalog, Boolean isQuoted) in NHibernate.Cfg.Configuration.GenerateSchemaUpdateScript(Dialect dialect,

How do I bind a WPF Image element to a PNG on the local hard drive using a relative filepath derived from a DB?

孤者浪人 提交于 2019-12-04 11:34:30
I've got a folder on the local hard drive with several images in it. The image names/paths are stored in a local SQLCE database. In a WPF application I'm trying to bind those images to an Image element (which eventually goes into a listbox). I've got the application to run and compile and the listbox shows up but there is no image where it is supposed to be. This is the XAML that defines the data template that the listbox uses... <Window.Resources> <DataTemplate x:Key="assetLBTemplate"> <StackPanel Orientation="Horizontal"> <Image Height="32" Width="32" Source="{Binding imageFileName}" />

Create database file (.sdf) if doesn't exists?

99封情书 提交于 2019-12-04 11:11:09
Just wondering about some practice about this; I have made a simple visual C# program with local database (SQL CE) (dB.sdf file). Let's say user deletes the dB.sdf file and try to open the exe program - nothing happens (the exe file starts but closes again). What's the typically practice here? Is it that the program just won't start or is it to make the program create a database file if it doesn't exists? If it is the latter, how is it done? The second approach is more wise as your program is uselsess if it depends on database which gets deleted. string connStr = "Data Source = DBName.sdf;