Search Results

Search found 17 results on 1 pages for 'sqlcompact'.

Page 1/1 | 1 

  • No SQLCompact Edition Support IN VS 2013

    - by James Izzard
    Firstly apologies if this is a poor question - I am an engineer not a programmer. I have spent time moving from Visual Basic to C#. I have started C#/SQL tutorials. I have noticed VS 2013 has stopped supporting the compact edition database normally used for standalone desktop apps. Somebody has kindly written a plugin to re-implement support. I have also noticed a belief circulating that SQLite is to replace the compact edition. Would anybody be able to advise if this was accurate - I am slightly confused as to which database is best suited for desktop app development inside VS 2013. Any comment greatly appreciated. Cheers James

    Read the article

  • Get id when inserting new row using TableAdapter.Update on a file based database

    - by phq
    I have a database table with one field, called ID, being an auto increment integer. Using a TableAdapter I can read and modify existing rows as well as create new ones. However if I try to modify a newly inserted row I get an DBConcurrencyException: OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Shift.mdb;Persist Security Info=True"); ShiftDataSetTableAdapters.ShiftTableAdapter shiftTA = new ShiftDataSetTableAdapters.ShiftTableAdapter(); shiftTA.Connection = conn; ShiftDataSet.ShiftDataTable table = new ShiftDataSet.ShiftDataTable(); ShiftDataSet.ShiftRow row = table.NewShiftRow(); row.Name = "life"; table.Rows.Add(row); shiftTA.Update(row); // row.ID == -1 row.Name = "answer"; // <-- all fine up to here shiftTA.Update(row); // DBConcurrencyException: 0 rows affected Separate question, is there any static type of the NewShiftRow() method I can use so that I don't have to create table everytime I want to insert a new row. I guess the problem in the code comes from row.ID that is still -1 after the first Update() call. The Insert is successful and in the database the row has a valid value of ID. How can I get that ID so that I can continue with the second Update call? Update: IT looks like this could have been done automatically using this setting. However according to the answer on msdn social, OLEDB drivers do not support this feature. Not sure where to go from here, use something else than oledb? Update: Tried SQLCompact but discovered that it had the same limitation, it does not support multiple statements. Final question: is there any simple(single file based) database that would allow you to get the values of a inserted row.

    Read the article

  • Using Entity Framework with an SQL Compact Private Installation

    - by David Veeneman
    I am using Entity Framework 4 in a desktop application with SQL Compact. I want to use a private installation of SQL Compact with my application, so that my installer can install SQL Compact without giving the user a second installation to do. It also avoids versioning hassles down the road. My development machine has SQL Compact 3.5 SP1 installed as a public installation, so my app runs fine there, as one would expect. But it's not running on my test machine, which does not have SQL Compact installed. I get this error: The specified store provider cannot be found in the configuration, or is not valid. I know some people have had difficulty with SQL Compact private installations, but I have used them for a while, and I really like them. Unfortunately, my regular private installation approach isn't working. I have checked the version numbers on my SQL CE files, and they are all 3.8.8078.0, which is the SP2 RC version. Here are the files I have included in my private installation: sqlcecompact35.dll sqlceer35EN.dll sqlceme35.dll sqlceqp35.dll sqlcese35.dll System.Data.SqlServerCe.dll System.Data.SqlServerCe.Entity.dll I have added a reference to System.Data.SqlServerCe to my project, and I have verified that all of the files listed above are being copied to the application folder on the installation machine. Here is the code I use to configure an EntityConnectionStringBuilder when I open a SQL Compact file: var sqlCompactConnectionString = string.Format("Data Source={0}", filePath); // Set Builder properties builder.Metadata = string.Format("res://*/{0}.csdl|res://*/{0}.ssdl|res://*/{0}.msl", edmName); builder.Provider = "System.Data.SqlServerCe.3.5"; builder.ProviderConnectionString = sqlCompactConnectionString; var edmConnectionString = builder.ToString(); Am I missing a file? Am I missing a configuration stepp needed to tell Entity Framework where to find my SQL Compact DLLs? Any other suggestions why EF isn't finding my SQL Compact DLLs on the installation machine? Thanks for your help.

    Read the article

  • Linq to SQL and SQL Server Compact Error: "There was an error parsing the query."

    - by Jeremy
    I created a SQL server compact database (MyDatabase.sdf), and populated it with some data. I then ran SQLMetal.exe and generated a linq to sql class (MyDatabase.mdf) Now I'm trying to select all records from a table with a relatively straightforward select, and I get the error: "There was an error parsing the query. [ Token line number = 3,Token line offset = 67,Token in error = MAX]" Here is my select code: public IEnumerable ListItems() { MyDatabase db_m = new MyDatabase("c:\mydatabase.sdf"); return this.db_m.TestTable.Select(test = new Item() { .... } } I've read that Linq to SQL works with Sql Compact, is there some other configuration I need to do?

    Read the article

  • Attempted to read or write protected memory-Sql Compact and .NEt

    - by Jankhana
    I'm using Sql Compact3.5 as my DB with C# .NET . I have a strange problem with my application. I'm running the code in two PC with same configuration except the Sql Compact installed. In one PC where Sql Compact3.5 is not installed I'm getting this strange error: Exception :Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Inner Exception : Stack Trace : at System.Data.SqlServerCe.NativeMethods.CloseStore(IntPtr pSeStore) at System.Data.SqlServerCe.SqlCeConnection.ReleaseNativeInterfaces() at System.Data.SqlServerCe.SqlCeConnection.Dispose(Boolean disposing) at System.Data.SqlServerCe.SqlCeConnection.Finalize() Source : System.Data.SqlServerCe I don't know where i have went wrong. I checked my code and included try catch everywhere. I'm handling Unhandled exception also using this . I am getting this error from a console application which I'm starting from Windows Form. In both the application I've inserted the Unhandled Exception coding and it's getting executed and getting return to the texxt file. But still Microsoft Don't Error Report is getting generated and I get that Dialog box!!! Y still that dialog box is getting generated is the trouble!!! Is there any way to supress that Dialog box??? Y I'm getting this box when I'm handling the exception and it's executing my catch handler??? In another PC where SQL Compact is installed no error I get!!! Any idea y is that so???

    Read the article

  • Creating an SQL Compact file: Template or script?

    - by David Veeneman
    I am writing an application that writes to SQL Compact files that have a specific schema, and I am now implementing the New File use case. The simplest approach seems to be to use a Template pattern: first, create a template file that lives in the application directory. Then, when the user selects New File, the template is copied to the name and destination specified by the user in a New File dialog. The alternative is a scripted approach: Use the same New File dialog, but dispense with the template file. Instead, create an empty SQL Compact file using the name/destination specified by the user, and then execute a T-SQL script on it from managed code. At this point, I am leaning toward the Template approach, because it is simpler. Is there any reason I should not use that approach? Thanks for your help.

    Read the article

  • Storing rich text documents

    - by David Veeneman
    This is a follow-up to another question I asked earlier today. I am creating a desktop app that stores rich text documents created in WPF (in a RichTextBox control). The app uses SQL Compact, and up until now, I had planned to store each document in a binary column in the database. I am rethinking that approach. Would it be better practice to store each rich text document in the file system, rather than saving it to the database? I figure I could put the documents in the same folder with the database, then store a relative path to each document in its database record, along with other information about the document (tags and so on). I'd like to know some pros and cons of that approach, along with ideas of what is generally considered best practice for this sort of thing. Thanks for your help.

    Read the article

  • When using SQL Compact on Windows Mobile, do you store the sdf file on a storage card?

    - by Michal Drozdowicz
    Having had some Sql Compact db corruption issues in the past and gone through the article on these, I got the idea that storing the database sdf file on a storage card significantly increases the risk of data loss due to db corruption. Do you store the sdf file on a storage card? Have you had any issues caused by it? What should I pay attention to when recommending a particular brand or model of an SD card wrt the stability and security for use with SQL Compact?

    Read the article

  • Breaking the SQL Compact 8K Limit?

    - by David Veeneman
    I am creating a desktop application that stores rich text documents to a SQL Compact database. Documents are converted to a byte array and stored as a Binary column, and I am running into SQL Compact's 8K limit for Binary field length. Is there a simple way to get around the 8K limit? I can come up with lots of complicated ways to do it, such as parsing into 8K chunks for storage and reassembling on fetch. But before I get into something that complex, I would like to make sure I can't solve the problem more simply, such as by changing data type. If there is no simple way of getting around the 8K limit, is thare a best practice for storing documents greater than 8K? Thanks for your help.

    Read the article

  • Correct way to close database connection in event of exception.

    - by lowlyintern
    /I have some code of of the following form. Does this mean the connection is left open if there is an exception? Note, I am using a Microsoft SQL compact edition database./ try { SqlCeConnection conn = new SqlCeConnection(ConnectionString); conn.Open(); using (SqlCeCommand cmd = new SqlCeCommand("SELECT stuff FROM SomeTable", conn)) { // do some stuff } conn.Close(); } catch (Exception ex) { ExceptionManager.HandleException(ex); } /*Surely a better way would be to declare a connection object before the try, establish a connection inside the try block and close it in a finally block? */ SqlCeConnection conn = null; try { conn = new SqlCeConnection(ConnectionString); conn.Open(); using (SqlCeCommand cmd = new SqlCeCommand("SELECT stuff FROM SomeTable", conn)) { // do some stuff } } catch (Exception ex) { ExceptionManager.HandleException(ex); } finally { if( conn != null ) conn.Close(); }

    Read the article

  • GUID or int entity key with SQL Compact/EF4?

    - by David Veeneman
    This is a follow-up to an earlier question I posted on EF4 entity keys with SQL Compact. SQL Compact doesn't allow server-generated identity keys, so I am left with creating my own keys as objects are added to the ObjectContext. My first choice would be an integer key, and the previous answer linked to a blog post that shows an extension method that uses the Max operator with a selector expression to find the next available key: public static TResult NextId<TSource, TResult>(this ObjectSet<TSource> table, Expression<Func<TSource, TResult>> selector) where TSource : class { TResult lastId = table.Any() ? table.Max(selector) : default(TResult); if (lastId is int) { lastId = (TResult)(object)(((int)(object)lastId) + 1); } return lastId; } Here's my take on the extension method: It will work fine if the ObjectContext that I am working with has an unfiltered entity set. In that case, the ObjectContext will contain all rows from the data table, and I will get an accurate result. But if the entity set is the result of a query filter, the method will return the last entity key in the filtered entity set, which will not necessarily be the last key in the data table. So I think the extension method won't really work. At this point, the obvious solution seems to be to simply use a GUID as the entity key. That way, I only need to call Guid.NewGuid() method to set the ID property before I add a new entity to my ObjectContext. Here is my question: Is there a simple way of getting the last primary key in the data store from EF4 (without having to create a second ObjectContext for that purpose)? Any other reason not to take the easy way out and simply use a GUID? Thanks for your help.

    Read the article

  • Can't add an object using EF and SQL Compact

    - by kamilo
    Hello, I have some very simple SQL Compact database. I would like to use Entity Framework to access the database but for some reason I can't add an object to this database using EF. Here is the code using (pos_inglotEntities posInglotCtx = new pos_inglotEntities()) { posInglotCtx.Connection.Open(); CT_POS_OITM item = new CT_POS_OITM() { ItemCode = "123", ItemName="abc"}; try { posInglotCtx.AddToCT_POS_OITM(item); posInglotCtx.SaveChanges(); } catch (Exception e) { } posInglotCtx.Connection.Close(); } After running this code my database is still empty although if I run it once again I get "duplicate values" exception. But again database is empty. I created this db using PrimeWorks conversion tool from standard sql server database. What is going on? Thanks in advance

    Read the article

  • sync framework server to server synchronization

    - by nihi_l_ist
    I have kind of a such scenario: Here i need to synchronize local server database with main DB server(example: computers in office are connected to office server and they use it like a local server, so that no sync is required.BUT computers in other office work with their local server too and we need synchronization between the offices though the main DB server.). As i see i cant use SQLCompact here. Is there a provider to do the server-to-server synchronization right from the client? If no can someone provide a sample of solution of how to manage such situation?

    Read the article

1