sql-server-ce

The selected object(s) use an unsupported database provider

…衆ロ難τιáo~ 提交于 2019-12-24 00:54:58
问题 I'm using Visual Studio 2010 In my project I was added a local database Data.sdf Now I wanna use LINQ TO SQL with it, but when I drag and drop the database table into the LINQ designer , I get the following error in Visual Studio : "The selected object(s) use an unsupported database provider" Am I miss something ? How can I fix it ? 回答1: LINQ-to-SQL is only officially supported when used with a full version of Microsoft SQL Server (including Express editions). While it's possible to use it

How can I use TransactionScope with SQL Compact 4.0 and NHibernate

血红的双手。 提交于 2019-12-24 00:07:09
问题 I am trying to use NHibernate in combination with .NET's TransactionScope object. So far I have successfully used Oracle 11g and SQL Server 2008R2 with no issues. However, SQL Compact seems to fall on its face. using (var scope = new TransactionScope(TranactionScopeOption.Required)) { using (var session = _sessionFactory.OpenSession()) { // The line below throws. I also tried passing in System.Data.IsolationLevel.ReadCommitted to no avail using (var txn = session.BeginTransaction()) { //

SQL CE Compact 3.5 Identity columns for a table

谁说我不能喝 提交于 2019-12-24 00:06:39
问题 Is there a query I can write against an INFORMATION_SCHEMA or against the system tables to determine if a column is an identity column in SQL CE version 3.5? 回答1: Use COLUMNPROPERTY . For ur reference a) COLUMNPROPERTY (Transact-SQL) b) Identity Columns 回答2: Try the following query: ;WITH PK_INFO AS (SELECT CON.TABLE_CATALOG, CON.TABLE_SCHEMA, CON.CONSTRAINT_NAME, USO.COLUMN_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS CON JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE USO ON CON.CONSTRAINT_NAME

Updating local SQL Server databases with ClickOnce Deployment

帅比萌擦擦* 提交于 2019-12-23 15:24:15
问题 I'm building an application which will use some settings and a local SQL Server. My question is, when it comes time to update the application; will the settings or data be overwritten? What happens if I want to change some tables around in the future? 回答1: Frankly, I've always thought that ClickOnce's way of handling data is dangerous. If you deploy a database with ClickOnce, it puts it in the DataDirectory. Then when you deploy an update to the application, it copies the database forward to

Using Dapper with BLOBs and SQL Server CE

笑着哭i 提交于 2019-12-23 14:20:16
问题 When using BLOBs with more than 8000 bytes of data, you need to specifically set Parameter.SqlDbType = SqlDbType.Image to make it work (as explained here). Dapper, when it sees a byte[] field, defaults to a SqlDbType.Binary , which means for larger blobs, the inserts and updates will fail with a data truncation error. Is there an elegant solution to this problem? Only option I can see is to code the entire transaction with ADO.NET methods. 回答1: I had the same problem. Resolved as follows:

SQL Server Compact Edition 4.0 SDK?

…衆ロ難τιáo~ 提交于 2019-12-23 12:44:00
问题 Where is the SQL Server Compact Edition 4.0 SDK? Bonus Reading In order to create a database in SQL Server Compact Edition you must call the function ME_CreateDatabase exported from sqlceme40.dll : The function is not documented on MSDN, and the header files do not ship with the redistributable (obviously). MSDN mentions 3 Compact Edition header files: sqlce_err.h : Error codes used by database sqlce_oledb.h : OLEDB standard programming interfaces sqlce_sync.h That page also mentions that, if

Why is this SqlCeCommand ExecuteReader call failing?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 06:40:45
问题 I adapted my code below from "Microsoft .NET Compact Framework" by Wigley and Wheelwright: SqlCeConnection cn = new SqlCeConnection(@"Data Source=\My Documents\Traffic.sdf"); String sSQL= "SELECT CarID, Reg, Location FROM Cars"); SqlCeCommand cmdSelect = new SqlCeCommand(sSQL, cn); cmdSelect.CommandType = CommandType.Text; SqlCeDataReader dtr = cmdSelect.ExecuteReader(CommandBehavior.Default); // It's "cmd." instead of "cmdSelect." in the book, but that doesn't compile while (dtr.Read()) {

The column cannot contain null values. SqlCE exception

末鹿安然 提交于 2019-12-23 05:29:33
问题 I'm getting the following exception when I attempt to insert some sample data into a SQL Server CE 3.5 database inside a WP7 application: Error: SqlCeException "The column cannot contain null values. [ Column name = Name,Table name = Exam ] The name is also the primary key. I think I have declared everything properly in the DataContext . private void InsertData() { mangoDb = new ExamDataContext(); // create a new exam instance Exam exam = new Exam(); exam.Name = "History"; exam.Description =

VS2010 depends on SQL Server Compact 3.5 for IntelliSense?

青春壹個敷衍的年華 提交于 2019-12-23 04:48:25
问题 I've just recently installed VS2010 Professional (trial) on my WinXP machine. Knowing that I only needed it for a VC++ project (with no databases), I "unchecked" the install options for SQL Server. However, when I try to create a new project (I've tried all variations of MFC and Win32 project types), I am presented with a lovely error message box: An error occurred while creating or opening the C++ browsing database file c:\path-to-project\testProject.sdf. IntelliSense and browsing

SQL Server CE query having no effect?

谁都会走 提交于 2019-12-23 04:47:33
问题 I'm attempting to insert rows into a SQL Server CE database, and it's returning that 1 row is affected, there's no exception, and no syntax error in the query as far as I can see - but it's having no effect, when I look in the table from the Database Explorer. If I run a query through VS, everything works fine. There's no connection problem as far as I can tell... what am I doing wrong here? Here's the code, though it probably doesn't make a difference: Using conn As New SqlCeConnection(My