sql-server-ce

Using SMO to script PARTIAL data content (only rows matching a WHERE clause)

偶尔善良 提交于 2019-12-07 09:32:25
I use SMO to fill a SQL Compact database with the data of a SQL server database. Here is the code I actually use: foreach(Table l_tblCurrent in l_dbDatabase.Tables) { if(l_tblCurrent.IsSystemObject) continue; ScriptingOptions l_scOptions = new ScriptingOptions(); l_scOptions.NoIdentities = true; l_scOptions.NoCollation = true; l_scOptions.NoCommandTerminator = true; l_scOptions.NoFileGroup = true; l_scOptions.ScriptSchema = true; l_scOptions.ScriptData = true; foreach(string l_strCurrent in l_tblCurrent.EnumScript(l_scOptions)) { l_sccDBFCommand.CommandText = l_strCurrent.Replace("[dbo].", "")

How can I programmatically determine if a table exists within a SQL Server CE database?

荒凉一梦 提交于 2019-12-07 09:13:47
问题 Back when I only had one table in my .sdf file, this code worked fine: const string sdfPath = @"\Program Files\duckbilled\Platypus.sdf"; string dataSource = string.Format("Data Source={0}", sdfPath); if (!File.Exists(sdfPath)) { using (var engine = new SqlCeEngine(dataSource)) { engine.CreateDatabase(); } using (var connection = new SqlCeConnection(dataSource)) { connection.Open(); using (var command = new SqlCeCommand()) { command.Connection = connection; command.CommandText = "CREATE TABLE

Should I use Lucene.Net for full text search with SQL Compact Edition 4, or is there a better option?

女生的网名这么多〃 提交于 2019-12-07 07:47:46
问题 I'm trying to create a full text search facility for a small blog which is running against a SQL Compact Edition 4 database. There seems to be almost no information out there about this (though I'd be happy if someone can prove me wrong), but as far as I can gather, SQL CE doesn't support the normal SQL Server full-text indexing. I have briefly looked into using Lucene.Net, but it seems quite complex at first glance; would this be my best option here, or is there a simpler solution which I'm

Moving data from SQL Compact to SQL Server 2008

淺唱寂寞╮ 提交于 2019-12-07 05:00:32
I have created an .SDF file and inserted data into the SDF database file on a mobile device. I want to transform .SDF file to a SQL Server 2008 Database File but don't know how. Any pointers or suggestions would be appreciated. You cannot directly convert a SQL Compact database into a full SQL Server 2008 database, as they are structured completely different. And as far as I know you cannot use SSIS (SQL Server Integration Services) to copy data from the SQL Compact database to a SQL Server database (the other way round would be possible). So the only real option seems to write some app that

NHibernate QueryOver<> - Aggregate function over SubQuery

不羁的心 提交于 2019-12-07 03:55:29
问题 How can I write the following SQL statement using QueryOver<> syntax? SELECT COUNT(*) FROM ( SELECT FirstName,LastName FROM People GROUP BY FirstName, LastName ) as sub_t I have the inner query working so far: var q = _session.QueryOver<Person>() .SelectList(l => l .SelectGroup(x => x.FirstName) .SelectGroup(x => x.LastName)); But I have no idea how to wrap this in a subquery and get a row count out of it. Can it be done? Unfortunately my RDBMS dialect (MsSqlCe40Dialect) does not support

extract schema for sql server compact edition

China☆狼群 提交于 2019-12-07 01:55:17
问题 Is there a way to generate the sql statement for tables in sql server compact ? same as for sql server express+ ? Essentially a create table( .... ) statement as output ? 回答1: There is a project on Codeplex that someone has actually built the functionality to be able to do scripting for sql server compact edition databases. 回答2: There is a tool to do this. Check out http://www.antipodeansoftware.com/Home/Products This will iterate the entire SQL server, and write all the table, view, stored

SQL: Return only first occurrence

十年热恋 提交于 2019-12-06 22:16:34
问题 I seldomly use SQL and I cannot find anything similar in my archive so I'm asking this simple query question: I need a query which one returns personID and only the first seenTime Records: seenID | personID | seenTime 108 3 13:34 109 2 13:56 110 3 14:22 111 3 14:31 112 4 15:04 113 2 15:52 Wanted result: personID | seenTime 3 13:34 2 13:56 4 15:04 That's what I did & failed: SELECT t.attendanceID, t.seenPersonID, t.seenTime (SELECT ROW_NUMBER() OVER (PARTITION BY seenID ORDER BY seenID) AS

How can I connect to a SQL Server Compact 3.5 file as a data source in Visual Studio 2012?

拥有回忆 提交于 2019-12-06 16:31:46
Visual Studio 2012 comes with SQL Server Compact 4.0. I have installed SQL Server Compact 3.5 from http://www.microsoft.com/en-GB/download/confirmation.aspx?id=5783 However I still only have the option of making a new data connection to a SQL Server Compact 4.0 file, whereas the files I need to get data from are SQL Server Compact 3.5 files. Is it possible to connect to a SQL Server Compact 3.5 file as a data source in Visual Studio 2012? If so which settings or installs should I need? dumbledad Over in a thread I started on SQL Server Developer Center > SQL Server Forums > SQL Server Compact

Visual Studio 2010: Can't create new connection to SQL Server Compact 4.0

孤街醉人 提交于 2019-12-06 16:28:56
I have just installed SQL Server Compact Edition 4.0 on my Windows 7 machine. (Note that I already had SQL Server Compact 3.5 SP2 on the machine). However, in my Visual Studio 2010 project, I am unable to create a new connection to a SQL Server Compact Edition 4.0 database... i.e. - by doing the following: In Server Explorer, right click "Data Connections" "Add Connection" "Change Data Source" - Microsoft SQL Server Compact 4.0 not an option (only version 3.5) How can I make Visual Studio 2010 know about my already installed copy of Microsoft SQL Server Compact 4.0? See SQL Server Compact 4.0

sql ce native exception 0xc0000005

夙愿已清 提交于 2019-12-06 15:09:55
When i run my .net 3.5 cf application that reads some data from ms sql ce, sometimes i get an native exception with the following info: ExceptionCode: 0xc0000005 ExceptionAddress : 0x44746e65 (variable) Reading: 0x44746e64 at NativeMethods.GetKeyInfo(IntPtr pTx, String pwszBaseTable, IntPtr prgDbKeyInfo, Int32 cDbKeyInfo, IntPtr pError) at SqlCeCommand.ExecuteReader(CommandBahavior behavior) (... omitted for brevity) at dadosGpsTableAdapter.GetDadosAEnviar() My GetDadosAEnviar query is very simple: SELECT _id, Latitude, Longitude, Ignicao, Altitude, Velocidade,Direcao, Qualidade, Timestamp,