sql-server-ce

SQL Query gets slower with each iteration?

自作多情 提交于 2019-12-25 06:35:00
问题 Is there anyway to make this SQL query faster? It searches a .sdf database for matching words. The data is arranged in alphabetical order. Currently it takes about 10-15 seconds to search, the first iteration of the search seems to be rather quick however the search becomes slower with each iteration? Why is this? Sorry this is my first experience with SQL. private void Search_Database() //Searches SQL Database for matching words { Possible_Words.Clear(); using (var cn = new SqlCeConnection(@

Conditional Insert?

怎甘沉沦 提交于 2019-12-25 03:35:27
问题 This is a kind of follow-up to my other question: Delimited string of ids as a field or a separate table? I have a database containing a table of products, one of categories, and one like "productsInCategories"(described in the other question). The productsInCategories-table has two fields: productId and categoryId. When I want to get all the products from a category I do something similar to: SELECT * FROM Products INNER JOIN ProductsInCategories ON Products.Id=ProductsInCategories.productId

SQL CE Dynamic Query

人走茶凉 提交于 2019-12-25 03:18:29
问题 One of my database tables in SQL CE 3.5 has a primary key. I want to alter the column in the primary key to expand it from an nvarchar(7) to nvarchar(20). Do I absolutely need to drop the primary key to achieve this? How can I drop the primary key with a script if I do not know the name of the primary key? The name is PK__sign_type__000000000000228E for example so it has been generated dynamically. I have 200 or 300 of these databases on our clients machines and a generic script is necessary

Getting Security Exception SQLCE 4, Code First CTP 5 & Shared Hosting

故事扮演 提交于 2019-12-25 03:14:14
问题 I've been trying to setup a webpage with MVC3 Razor, SQLCE 4 and Code First, the last two downloaded from Nuget, so it is EF Code First CTP5. I've had a lot of trouble, but I manage to move forward by following this answer However now I am getting this Security Exception Description : The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust

SQL CE 3.5 & EntityFramework

本秂侑毒 提交于 2019-12-25 03:05:40
问题 I have an sqlce 3.5 local db file in my VS2010 solution used with an EF4 Model. I need to protect my db with a password but do not serialize it in app.config. I also need to set up the maximum database file size to it's maximum allowed value which is 4091 MB when I try to set the connectionString in code, I can't find a way to set the 'Max Database Size=4091'. Here is a method that I use to build the connection string private string GetConnectionString() { // Specify the provider name, server

Deploying application using SQL CE 4.0 to work both in 32 and 64 bit PC

半世苍凉 提交于 2019-12-25 02:46:42
问题 I am planning to create an application which uses SQL CE 4.0. I saw like there are two types of deployment central and private. So now i am planning to use private deployment. So all the dll must be included in the project as explained here. But I tried just adding all dll from my XP PC(32 bit) and not added any 64 bit dlls(but it was mentioned to add 64 bit dlls). Then i set platform to x86. After building application i tried running my application in a 64 bit PC and it worked properly. I

EF and SQL Server CE with NuGet

自古美人都是妖i 提交于 2019-12-25 02:29:07
问题 While poking around NuGet I noticed a couple of packages that I have already installed, EF and SQL Server CE. This raised a couple of questions that I have not been able to find any information on. On EF package what does this add that isn't already there in VS or does it just do all the reference work for you? On SQL Server CE package, what does this add that installing it doesn't? Or is this just a better way to install it. It certainly takes a lot to get an environment setup and I like

Can I use SQL Server CE in a medium trust environment by just deploying the DLLs

不想你离开。 提交于 2019-12-25 00:52:24
问题 I've written an ASP.NET 4.0 application that is using a SQL Server CE 4.0 database. This is all working on my development environment using Medium Trust (same trust config as the hoster). On this machine, I've gone through the install process (downloaded and installed the MSI). I'm now trying to deploy this solution to my web hoster. The code that is running is (this is a straight out copy of the Altairis Membership Provider: using (HostingEnvironment.Impersonate()) using (var db = this

Convert timestamp(Datetime.ticks) from database to Datetime value before displaying it in DataGridView

半城伤御伤魂 提交于 2019-12-24 20:20:17
问题 I am using SQL server compact edition as the backend in my winform application. I have a column timestamp in one of my tables. I have stored timestamp as follows : DateTime dt = System.DateTime.Now; long timestamp = dt.Ticks; It stores a long value representing current date and time into the database. I want to display table's data in a DataGridView control by setting its DataSource property. When I retrieve table data using SQL query "select * from my-table" and attach to DataSource, it just

Is this the right way to query a SQL Server CE table for a record, populating and returning a custom object?

家住魔仙堡 提交于 2019-12-24 19:29:47
问题 The code below works, but I'm wondering if it's more loquacious than necessary: public static InventoryItem SelectLocalInventoryItem(string ID) { const int ID_COL = 0; const int PACKSIZE_COL = 1; const int DESCRIPTION_COL = 2; const int DEPTDOTSUBDEPT_COL = 3; const int UNITCOST_COL = 4; const int UNITLIST_COL = 5; const int UPCCODE_COL = 6; const int UPCPACKSIZE_COL = 7; const int CRVID_COL = 8; var invItem = new InventoryItem(); using (var conn = new SqlCeConnection(dataSource)) { var cmd =