sql-server-ce

Classic ASP ADODB with SQL Server Compact Edition 3.5 is not working in Command Parameters

Hi All, I'm new to SQL CE. I'm programming in Classic ASP, connecting the SQL CE using ADODB.Connection. I have created the table and trying to insert data from the ASP. I tried in 3 ways. The inline insert statement [e.g. INSERT INTO tblName(col1, col2) VALUES(1,2)] (WORKED) The parameterized insert statement [e.g. INSERT INTO tblNam...

Deleting Entities on Entity Framework 4

I'm using Entity Framework 4. I'm detaching the object graph using Serialization. Getting the List, bind to a BindingSource, to the GridControl and deleting adding modify rows. Then go back and Attach the object graph back. How to ensure which rows are for deletion, which are modified, added rows is easy for EF to understand. I'm also th...

SQL Compact Edition 3.5 - Access to the database file is not allowed

Windows 7, Visual Studio 2010, .NET 4 Client Profile I developed an application (100% local, no access to servers) using SQL CE 3.5, it works fine on my computer. However, when i deployed it on another computer, it shows this error: Access to the database file is not allowed. [ File name = data\BDApepucCE.sdf ] I deployed on a window...

SqlCeCommand does NOT support subqueries ?

yesterday I wanted to create a sql query ( using system.data.sqlce ) which return values from diff tables on mobile devices. My scenario is as follows: - sql table: Xtable (fields: name : is string, mat : is string, state : is int value); - XTable contains 100 records my sql statement is: SELECT name, (SELECT count(*) from Xtable wher...

Can Entity Framework be used to generate SQL Server Compact database

I created a project as described here using Visual Studio 2010 and .NET 4 (Win7/x64). Once I've change the platform target to 'Any CPU' the sample project works. However, if try to generate a model from entity data model (right-click the model and select 'Generate Database from Model'), I get the following error. Could not find the appr...

SQL statement won't insert into DB.sdf

Hi guys, I am using Visual Studio 2008 and have connected a database correctly as I have done a login that works fine, although when I try to insert information submitted in the text boxes a different table, it doesn't enter after I end program to check it still has no data in. Any ideas? Dim con As SqlCeConnection = New SqlCeConnec...

evaluating a boolean against a bit field in LINQ To SQL query

I am trying to do a simple little LINQ To SQL query against a SQL CE database. var result = from item in items where item.IsTrue == true select item; The problem is that the IsTrue property is a bit field in the database (bool in the CLR). When it goes to SQL in CE I get SELECT ... WHERE ([t0].IsTrue = 1).. ...

How to get started with SQL Server Compact 4.0?

I've downloaded the install files and ran them, I get some binaries in my program files folder and I've added a reference in my project to the dll. But how the heck to I create the .sdf file? It feels like I'm missing some sort of obvious clue... ...

inserting Datetime into SQLCE with milliseconds C#

I have a string datetime in this format "dd-MM-yyyy HH:mm:ss.fff" like so.. DateTime mydate = Convert.ToDateTime("13-09-2010 02:30:14.905"); result.SetValue(1, mydate); //I get a error saying 'String was not recognized as a valid DateTime' if i do it this way DateTime mydate = DateTime.ParseExact("13-09-2010 02:30:14.905", "dd-...

Should I include my SDF file (SQL CE 3.5) as an item when adding solution to source control?

I have a visual studio 2010 solution that uses a SQL CE fiel (SDF) for storing data in one of the projects. I am wondering, is it a good practice to add this SDF file to the source control so that whenever I make any changes in the database, I commit it to source control? Sometimes all i do is a name change for example, then I have to c...

Entity Framework 4, SQLCe with POCO problem on delete.

Hello, I have a SQLCe database which had a unique primary key Id with type uniqueidentifier, and child relationship, 1 to many, where i keep the master id in a column and append unique id for every row too. Now I use POCO entities for my domain model NOT STE. While adding and modifying entities works OK, I have hard time to delete, say ...

Trying to do a hierarchical update results in an error "A foreign key value cannot be inserted"

I'm a bit of a noob with DAO and SQL Server and I'm running into a problem when I'm trying to insert values into two tables that have a relation. The table Photos has a gpsId field which has a foreign key relation with the id field of the GPSLocations table. I want to create a new Photos entry linked to a new GPSLocation, so the code l...

SqlCeCommand and Batch Inserting

Dear Friends I would like to know that is it possible to Insert a batch of SqlCeCommand(s) ? note : All SqlCeCommand(s) have got a property. ( not solid sql command ) thank you; ...

SQLCE: Find next available date

I have a SQLCE table with a date field. Any given date could have one or more records. My client would like the input form to default to the next date (starting from and including the current date) that doesn't yet have a record. I'm having trouble wrapping my head around a query to accomplish this. Googling I've found a couple snippets,...

GUI Tool for SQL CE 4?

Is there a good GUI tool out there for managing SQL CE 4 databases yet? Something that doesn't require me to write create table statements for instance. ...

What makes this database's cascading deletes cyclical?

Vendor (PK) - Id Name Stand (PK) - Id VendorId - fk - cascaded delete if Vendor is deleted) Name Item (PK) - Id VendorId - (fk - cascaded delete if Vendor is deleted) Name Price UnavailableItem (PK) - ItemId - (fk - cascaded delete if Item is deleted) (PK) - StandId - (fk - cascaded delete if Stand is deleted) The database above repr...

Generating Integer Identity Primary Key for Entity Object in Entity Framework and SQL Server CE

Hello I heard that this issue is fixed in SQL Server Compact Edition 4.0 CTP As recently I just stepped into SQL Server CE and Entity Framework, and VS2010 not yet supporting SQL Server CE 4.0 I think I would need a work around for this issue Can I know how to generate an Integer type Identity Primary Key inside the constructor of th...

C# system.io.filenotfoundexception

I am creating an app for my work to track behavior management over the course of a school year. To do this, I obviously needed a database. I built the program so that it would, when opened, check to see if the database exists, and if it doesn't, it creates one, and inputs the schema. This works perfectly on my dev computer, but when I ...

Embed Special Folder in SQL Compact connection string?

I am creating a SQL Compact demo, and I want to point the connection string in my App.config file to %CommonAppDataFolder% (the Special Folder token that points to c:\ProgramData on Windows 7 machines). My current connection string hard-codes the ProgramData folder reference: Data Source=c:\ProgramData\Foresight Systems\SQL Compact Demo...

Security violation in c:\ProgramData?

I am working on a SQL Compact demo app, and one of the things I my setup project does is copy an SDF file to the user's c:\ProgramData folder. However, when the app is run on the user's machine, I get the following error: System.Data.EntityException: The underlying provider failed on Open. ---> System.Data.SqlServerCeException: Acces...