sql-server-ce

Check SQL Server CE database after INSERTION for application evaluation

匆匆过客 提交于 2019-11-29 17:26:44
I have the following script for insertion into a SQL Server CE database SqlCeConnection Con = new SqlCeConnection(); Con.ConnectionString = (@"Data Source=|DataDirectory|\Database.sdf;Password=Password;"); Con.Open(); SqlCeCommand Query = new SqlCeCommand("INSERT INTO Users(ID,Name,FName,Address,MCode,MNum,Amount) VALUES(@ID,@Name,@FName,@Address,@Code,@Num,@Amount)", Con) Query.Parameters.AddWithValue("@ID", ID + 1); Query.Parameters.AddWithValue("@Name", NBox.Text); Query.Parameters.AddWithValue("@FName", SOBox.Text); Query.Parameters.AddWithValue("@Address", AdBox.Text); Query.Parameters

Error on using TransactionScope in EF4 & SQL Compact 4

烈酒焚心 提交于 2019-11-29 17:06:23
using (TransactionScope scope = new TransactionScope()) using (var context = new dwfEntities()) { var field = (from x in context.DynFields where x.Id == id select x).First(); //delete defaults foreach (var item in from x in context.DynFieldDefaults where x.DynField_Id == id select x) { context.DeleteObject(item); } context.SaveChanges(); //delete field context.DeleteObject(field); context.SaveChanges(); //commit scope.Complete(); } The code throws "The connection object can not be enlisted in transaction scope" Does SQL CE 4 support TransactionScope ? if not, is there any workaround so I can

SQLServerCE Problem with parameterized queries from .NET

*爱你&永不变心* 提交于 2019-11-29 15:45:55
I am pulling the hair out of my head trying to figure this one out. I can't make Parameterized queries to work in VB.Net, when I am using parameters. From what I have found, using a parameter in a function, from .NET raises an error (see sample code). However, running the not working query in the Query Window in Visual studio works properly. The error raised is: 25922 - The arguments for function are not valid. Info from: http://msdn.microsoft.com/en-us/library/aa256772%28SQL.80%29.aspx Sample Code: Imports System.Data.SqlServerCe Public Class MiniDemo Public Shared Sub Main() Dim cs As String

Exponentially deteriorating performance on inserts in SQL Server Compact 4.0 tables with an Identity column

假装没事ソ 提交于 2019-11-29 14:34:41
EDIT: the issue below has been fixed in the Entity Framework 6. Running the code below takes a disappointing 2 minutes and 10 seconds. Running it a second time takes 6.5 minutes. This question is related to this one Private Sub RunTest() Dim sw As New Stopwatch sw.Restart() Using db As New TestDB db.Configuration.AutoDetectChangesEnabled = False For n = 1 To 100 For m = 1 To 100 db.Tops.Add(New Top) Next Next db.SaveChanges() End Using MsgBox(sw.Elapsed.ToString) End Sub The Entity: Public Class Top Public Sub New() MyBase.New() One =

Should I call “SqlCeEngine.Upgrade()” when both the SDF file and the device are seemingly the same version (2)?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 12:58:58
This is a followup to a question here ctacke said there regarding SQL Server CE-related "issues" I was/am having: " The problem, as indicated by the error text, is that the SDF file was created by a version of SQL Compact that doesn't match the version of SQL Compact that the application is referencing. I wouldn't focus on the reported version numbers, just the fact that it knows there's a mismatch. If you don't know the version of the SDF, you can always look it up by reading a few bytes from the SDF file. SQL Compact database files aren't 100% transportable. You definitely cannot take an SDF

How can I make this query in SQL Server Compact Edition?

亡梦爱人 提交于 2019-11-29 12:25:44
this subquery works in SQL Server: select systemUsers.name, (select count(id) from userIncidences where idUser = systemUsers.id ) from systemUsers How can It be made in SQL Compact? Thanks! Try this: SELECT su.Name, COUNT(ui.ID) FROM systemUsers su LEFT JOIN userIncidences ui ON ui.idUser = su.ID GROUP BY su.Name [Edit:] I originally had an INNER JOIN just like Tomalak, but I realized that this would exclude users with no incidents, rather than show them with a 0 count. That might even be what you want, but it doesn't match your original. There are cases when you can't avoid a subquery, for

Import Access data into SQL Server CE (.mdb to .sdf)

一个人想着一个人 提交于 2019-11-29 11:53:58
I've found a few articles & discussions on how to import data from Access to SQL Server or SQL Server Express, but not to SQL Server CE. I can access both the the Access data and CE data in the VS database explorer with seperate connections, but don't know how to move the data from one to the other. (I'm using c#.) Any suggestions? Thanks. You might look at PrimeWorks' DataPort Wizard . You can do it using SSIS , or even in SQL Server Explorer if you are not looking to do it programmatically. you can also use the the "sql server migration wizard" to convert it to sql server database and the

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

Select newly added Row - DataGridView and BindingSource

一曲冷凌霜 提交于 2019-11-29 11:35:18
I'm adding a new Row to a BindingSource that is Bound to a DataGridView source.AddNew(); After this, use BindingSource to get the newly added row is return the next row in the DataGridView when its sorted. ROW "A" ROW "B" <- myBindingSource.AddNew(); ROW "C" myBindingSource.Current gives ROW "C". (it became the selected row in the DataGridView) I need this because I want to update just the newly added row DataRowView drv = (DataRowView)myBindingSource.Current; myTableAdapter.Update(drv.Row); and not the entire table. myTableAdapter.Update(myDataSet.myTable); and also, I would like to have this

How to use SQL Server Compact Edition (CE) from Java?

别等时光非礼了梦想. 提交于 2019-11-29 10:25:31
I want to access Microsoft SQL Server Compact Edition databases from Java. How can I do that? I searched for JDBC driver for SQLCE, but I didn't find any. According to a newsgroup post sent this Tuesday (2008-12-09) by Jimmy Wu@Mircrosoft : The Microsoft SQL Server JDBC Driver does not support connecting to SQL Server Compact. At this time there isn't a scheduled JDBC support for SQL Server Compact edition. Thank-you for your continuing support of SQL Server. Sincerely, Jimmy Wu According to MSDN , there isn't one and there aren't any plans neither. While I'm not familiar with SQL Server CE, I