sql-server-ce

Cascade delete on many-to-many between same table

你离开我真会死。 提交于 2019-12-21 10:58:51
问题 I'm trying to create a many-to-many relation between the same table in SQL Server. I have one table Object with columns ObjectId and Name . The relation follows these rules: a child can have many parents a parent can have many children ObjectA can be a child of ObjectB and ObjectB can be a child of ObjectA but an object cannot be a direct child of itself So I create a second table ObjectRelation with columns ParentId and ChildId and of course I want these relations to be deleted by cascade.

Cascade delete on many-to-many between same table

末鹿安然 提交于 2019-12-21 10:58:27
问题 I'm trying to create a many-to-many relation between the same table in SQL Server. I have one table Object with columns ObjectId and Name . The relation follows these rules: a child can have many parents a parent can have many children ObjectA can be a child of ObjectB and ObjectB can be a child of ObjectA but an object cannot be a direct child of itself So I create a second table ObjectRelation with columns ParentId and ChildId and of course I want these relations to be deleted by cascade.

relative path for database file in config file

流过昼夜 提交于 2019-12-21 09:03:05
问题 I've created a WCF REST service that uses nhibernate to connect to sql server compact edition database. Hence I configure the NHibernate datasource like: <property name="connection.connection_string">Data Source=[Path]\MyDb.sdf</property> The annoyance I'm running into now is that I can't figure out how to avoid having to write out the absolute path in the config. This is annoying since I keep the database file as part of the project in the App_Data folder. So I shouldn't have to update the

relative path for database file in config file

∥☆過路亽.° 提交于 2019-12-21 09:01:11
问题 I've created a WCF REST service that uses nhibernate to connect to sql server compact edition database. Hence I configure the NHibernate datasource like: <property name="connection.connection_string">Data Source=[Path]\MyDb.sdf</property> The annoyance I'm running into now is that I can't figure out how to avoid having to write out the absolute path in the config. This is annoying since I keep the database file as part of the project in the App_Data folder. So I shouldn't have to update the

How to import data in SQL Compact Edition? [closed]

﹥>﹥吖頭↗ 提交于 2019-12-21 08:07:09
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I don't seem to find a tool for it, nor an odbc driver. Thanks UPDATE : I'm aware of the sql scripting possibilities. But than again : how to script a sql 2k table? (not just ddl, but data also?) Of course you

SQL Compact select top 1

走远了吗. 提交于 2019-12-21 07:48:06
问题 While porting an application from SQL 2005 to SQL Server Compact Edition, I found that I need to port this command: SELECT TOP 1 Id FROM tblJob WHERE Holder_Id IS NULL But SQL Server Compact Edition doesn't support the TOP keyword. How can I port this command? 回答1: SELECT TOP(1) Id FROM tblJob WHERE Holder_Id IS NULL Need the brackets as far as I know. reference: http://technet.microsoft.com/en-us/library/bb686896.aspx addition: likewise, only for version 3.5 onwards 回答2: This is slightly

Programmatically create a SQL Server CE table from DataTable

[亡魂溺海] 提交于 2019-12-21 05:32:16
问题 Does anyone know the best way to create a SQL Server CE (Compact 3.5) table based on the schema of a DataTable at runtime? I don’t want to have to formulate a CREATE TABLE statement based on all the different possible datatypes, etc. As a bonus – do you then know how to fill it directly from a datatable? 回答1: I've used and updated the Code from Ben Breen: Changed GetSqlServerCETypeName to work with all types Added a function fow a whole Dataset And some minor tweaks GetSqlDBTypeFromType ///

How to check a SQL Server CE database for indexes?

放肆的年华 提交于 2019-12-21 03:45:39
问题 Is there a way to list all SQL Server CE database table indexes, or at least for individual tables? 回答1: -- Retrieves information about the indexes contained in the database. SELECT * FROM INFORMATION_SCHEMA.INDEXES -- Retrieves all the Tables in the database including the System tables. SELECT * FROM INFORMATION_SCHEMA.TABLES Arjuna Chiththananda - Retrieving Schema Information of SQL CE Database 回答2: Thank you Arjuna! you pointed me in the right direction..... The following works. SELECT 'Y

Inserting a row and retrieving identity of new row in SQL Server CE

别说谁变了你拦得住时间么 提交于 2019-12-21 01:30:13
问题 I'm trying to insert a row and get back the new row's identity with something like this: INSERT INTO blah....; SELECT @@IDENTITY as NewID; I'm trying to execute both statements with a single invocation of a DbCommand object in C#... it doesn't seem work or I've got something wrong. I've read that Compact Edition doesn't support executing multiple statements in a batch... but I also found this: If you want to run multiple queries simultaneously, you must include a new line character for each

Update/Insert to a table using SQLCeResultSet

心已入冬 提交于 2019-12-20 21:02:14
问题 I have a SQL Compact Edition Database that I update periodically (via web services). The part where I write to the database is taking way too long. I am currently doing it with Linq to Datasets (as seen in this question). I have heard that if I do it with with SQLCeResultSet that it will work faster. So, given that I have a table like this: tblClient +- CLIENT_ID {Unique identifier} (Primary Key) +- CLIENT_NAME {varchar (100)} +- CLIENT_ACTIVE {bit} And I have it in object that I get from my