sql-server-ce-4

UPDATE on two INNER JOINed tables in SQL Server Compact 4

被刻印的时光 ゝ 提交于 2019-12-02 00:27:00
问题 I'm trying to update values between two tables in sql server compact edition 4.0. My sql is like below: UPDATE ei SET ei.EstateID=e.EstateID FROM EstateImages ei INNER JOIN Estates e ON e.TempKey=ei.TempKey Also tried this: UPDATE EstateImages SET EstateID = (SELECT EstateID FROM Estates WHERE TempKey = EstateImages.TempKey) I'm having error: There was an error parsing the query. [ Token line number = 1, Token line offset = 37, Token error = SELECT ] 回答1: If you check Books Online or other

Entity Framework 4.1 DatabaseGeneratedOption.Identity Performance

元气小坏坏 提交于 2019-12-01 14:30:43
I currently working on a application that use Entity Framework 4.1 (code first) and SQL Server CE 4.0. One of the new things I really like from SQL Server CE 4.0 are the computed values. But I have some performance problem while importing old data into my new data store system (around 50000 entries). This is my second implementation for this. The first version used Entity Framework 4.0 and SQL Server CE 3.5. But there is a huge performance difference between these implementations. The code first implementation takes around one hour to import the entries, the other implementation only some

A duplicate value cannot be inserted into a unique index [closed]

泪湿孤枕 提交于 2019-11-30 19:07:18
Self answering question for future reference: If you have a table where you deleted and re-added content, you can get this error while inserting new rows with an ID equal to existing IDs: Server Error in '/' Application. A duplicate value cannot be inserted into a unique index. [ Table name = Stories,Constraint name = PK__Stories__000000000000001C ] Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlServerCe

A duplicate value cannot be inserted into a unique index [closed]

霸气de小男生 提交于 2019-11-30 03:11:14
问题 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 8 years ago . Self answering question for future reference: If you have a table where you deleted and re-added content, you can get this error while inserting new rows with an ID equal to existing IDs: Server Error in '/'

LINQ to Entities StringConvert(double)' cannot be translated to convert int to string

若如初见. 提交于 2019-11-29 15:17:33
Problem Need to convert int to string using EF4 + SQL CE4. The recommended option of using SqlFunctions.StringConvert(double) still gives me errors. Option 1 (original). This gives me error: public static IEnumerable<SelectListItem> xxGetCustomerList() { using (DatabaseEntities db = new DatabaseEntities()) { var list = from l in db.Customers orderby l.CompanyName select new SelectListItem { Value = l.CustomerID.ToString(), Text = l.CompanyName }; return list.ToList(); } } Option 2 (most suggested). Then as many posts suggests, I used the SqlFunctions.StringConvert() function from the library

Ado connection to SQL Server Compact Edition 4.0

匆匆过客 提交于 2019-11-29 11:45:17
I want to connect to SQL Server Compact Edition 4.0 from an old asp-classic site but i always get the error: "Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified. " I tried sCon = "Data Source=c:\temp\sqlcompact.sdf;Encrypt Database=True;Password=testtest;Persist Security Info=False;" and Update: Error: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done sCon = "Provider=Microsoft.SQLSERVER.CE.OLEDB.4.0;Data Source=c:\temp\sqlcompact

Ado connection to SQL Server Compact Edition 4.0

血红的双手。 提交于 2019-11-28 05:30:22
问题 I want to connect to SQL Server Compact Edition 4.0 from an old asp-classic site but i always get the error: "Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified. " I tried sCon = "Data Source=c:\temp\sqlcompact.sdf;Encrypt Database=True;Password=testtest;Persist Security Info=False;" and Update: Error: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if

Using SQL Server CE 4 on a remote host with MVC 3

此生再无相见时 提交于 2019-11-27 18:22:14
I just upgraded my host to MVC 3 but I'm trying to do a "hello world" using SQLCE 4.0 but I just got: Sorry, an error occurred while processing your request. I see my layout and everything but instead of data I see that. On localhost is working as expected I have: <add name="PruebaContext" connectionString="Data Source=|DataDirectory|db.sdf" providerName="System.Data.SqlServerCE.4.0"/> as connectionString. I put the sdf as part of the project, I added the System.Data.SqlServerCE.dll to the project with the local copy to true. I have no more ideas. The connString, the dll is in /bin and is

Using SQL Server CE 4 on a remote host with MVC 3

狂风中的少年 提交于 2019-11-27 04:16:36
问题 I just upgraded my host to MVC 3 but I'm trying to do a "hello world" using SQLCE 4.0 but I just got: Sorry, an error occurred while processing your request. I see my layout and everything but instead of data I see that. On localhost is working as expected I have: <add name="PruebaContext" connectionString="Data Source=|DataDirectory|db.sdf" providerName="System.Data.SqlServerCE.4.0"/> as connectionString. I put the sdf as part of the project, I added the System.Data.SqlServerCE.dll to the

DbSet.Find method ridiculously slow compared to .SingleOrDefault on ID

混江龙づ霸主 提交于 2019-11-27 03:34:35
I have the following code (Database is SQL Server Compact 4.0): Dim competitor=context.Competitors.Find(id) When I profile this the Find method takes 300+ms to retrieve the competitor from a table of just 60 records. When I change the code to: Dim competitor=context.Competitors.SingleOrDefault(function(c) c.ID=id) Then the competitor is found in just 3 ms. The Competitor class: Public Class Competitor Implements IEquatable(Of Competitor) Public Sub New() CompetitionSubscriptions = New List(Of CompetitionSubscription) OpponentMeetings = New List(Of Meeting) GUID = GUID.NewGuid End Sub Public