I have a function thats inserts data to a table with a SqlCeCommand with 42 Parameters. It had always worked perfectly with WMobile 2003 and WMobile 5 devices until now.
Recently I got 2 new pdas (both Phone Edition) which crash in that function with de following error: Exception An SqlCeParameter with ParameterName '@totallinesamountwithlinediscounts' is not contained by this SqlCeParameterCollection.
I tried putting a shorter name on the param and it worked (well, it failed because another long name param). To make sure it was a length problem it changed the long name with a dummy long name (@a234567890b234567890c234567890d23) and amazingly it worked.
After some tries I got that the failing parameters were: @TotalLinesAmountWithLineDiscounts @TotalLinesAmountWithAllDiscounts @TotalLinesAmountIncludingTax
I thought it could be caused because the parameters have similar names but when I replaced the params with: @a234567890b234567890c234567890d @a234567890b234567890c234567890d23 @a234567890b234567890c234567890d2345 It worked properly, and they have similar name also.
I've tried the same binaries and database on other devices and their work properly with the correct names.
I can make it work with this weird names but I would like to know the source of the problem to avoid future errors.
Does anyone have an idea of what may be the problem? Is there any known issue about problems with SqlCeParameters and different versions of Windows Mobile?
I am currently upgrading our ppc app (written in .net 2003) to .net 2005 and from sqlce 2.0 to 3.0. The new application runs out memory(storage) when handling lots of data transactions (both in case of using sqlcedatareader, and dataset ). There is no memory leak issue here, sqlce 3.0 simply uses a lot more (3 times more) memory than sqlce 2.0.
Our applicaton runs fine using sqlce 2.0 and .net 2003, but fail due to memory shortage
with the upgrades(which has the same code). Anyone can shed some lights on this issue?
Dim oParameter As New System.Data.SqlServerCe.SqlCeParameter("@pMyParameter", SqlDbType.Binary, 3000)
If you set a watch on this object, the size is set back to 510. I have tried resetting the size back to 3000 after construction using oParameter.Size, but it doesn't change from 510. If the command is executed using ExecNonQuery, this causes the bytes to get cut off at 510 bytes and returns the error: Byte array truncation to a length of 510.
Can I insert data into SQL Server 2005 Mobile Edition, into a field of data type binary(3000) using .NET CF 2.0 via SqlServerCe objects?
SqlCeParameter.Size seems to be limited to 255 characters for char types.
Eg.
SqlCeParameter param = new SqlCeParameter();
param.ParameterName = parameter_name;
param.DbType = DbType.String;
param.Size = 260;
Now check the value of param.Size, it will be 255.
In the past this problem was avoidable by setting the size to 0. However, this cause a problem if you are re-using the same command and simply changing the parameters value.
Somewhere the system remembers the length of the first value and adjusts the max size to be limited to this length.
Thus for the following values:
"Test"
"Testing"
The second one will error with something like "@param: String truncation: max = 4, len = 7, value = 'testing' "
Has anyone else come across this problem, or found a solution to it?
I came across a frustrating bug last week. Basically, whenever I tried to execute almost any sql query with unnamed parameters (i.e. using "?" instead of "@param_name" in the SQL text), an exception would be thrown.
After trying lots and lots of things and navigating my way through the internals of System.Data.SqlServerCe.dll, I discovered that the method System.Data.SqlServerCe.SqlCeCommand.CreateParameterAccessor(...) has a bug.
The bug is that the private arrays "parameters" and "metadata" are ordered differently, yet at one point in CreateParameterAccessor(...) they are compared using the same index. Here are the two lines: p = this.parameters[ i ]; and MetaData info = metadata[ i ] and then the column data types of "info" & "p" are incorrectly compared in a later method, ValidateDataConversion(...).
So take a step back... how are they ordered differently? From observation, I concluded the following: The "parameters" array is ordered exactly in the order that the DbParameter's were added to the DbCommand object. The "metadata" array is ordered according to the column order of the table in the database.
So what causes the exception? Well, CreateParameterAccessor(...) passes data types from two different columns (one type taken from parameters[ i ] and the other from metadata[ i ]) on to SqlCeType.ValidateDataConversion(...). And, of course, if they differ (e.g. one column is of type DateTime and the other is a SmallInt), an exception is thrown. I've found two workarounds, and both seem to work well. The first is to name the SqlCeParameters (e.g. "SELECT ... WHERE id=@id"). This causes the buggy branch of code to be completely bypassed.
The second is to add the SqlCeParameters in the exact same order as the columns exist in the table you are accessing. Note, I do *not* mean the order that you select the columns (e.g. "SELECT column1, column2, ..."). I mean the actual order of the columns in the database.
I've included my setup and a stack trace below to help if it can.
My setup is: .Net CF 3.5 SqlServer CE 3.5 Visual Studio 2008 Deployed to Pocket PC 2003
Here is the stack trace (note the variables passed to ValidateDataConversion):
Does anyone have any instructions on how to go about uprading a .sdf file from sqlce 2.0 to sqlce 3.0?
I found this on an msdn website (link: http://www.microsoft.com/sql/editions/sqlmobile/upgrading.mspx) but as you can see its very lacking on detail. (I included the link and content referring to upgrading the database files so you won't have to go to the link to see the part referring to upgrading the database.) I tried to run the upgrade.exe on my device but it doesn't explain how you're supposed to point it to the .sdf that you are trying to update. Here is the content on the above web page.
Upgrading Database Files You can upgrade a database created with an earlier version of SQL Server CE 2.0 to a database created with SQL Server Mobile by using the SQL Server Mobile Database Upgrade tool (upgrade.exe). The Database Upgrade tool runs on a smart device.
When you run the SQL Server Mobile Database Upgrade tool, the new SQL Server Mobile database is created on the smart device. The new database, with the file name extension .sdf, contains all the data that was in the source database. You need to reinitialize the upgraded database to continue using it for replication.
Note: If you are using replication or remote data access (RDA) as a connectivity solution before upgrading to SQL Server Mobile, you must synchronize the source SQL Server CE database (subscription database) with the SQL Server database (Publisher). The reason for synchronizing before upgrading to SQL Server Mobile is to ensure that any changes that exist in the tables on the SQL Server CE database are updated on the SQL Server database, because after the upgrade you must resubscribe or repull using the new database.
My app is working on my local system with the vs2008 development server. It's an asp.net app and I added the line: AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true);
So it works fine on my system. But I can't get it to work on shared hosting. I have uploaded all the sqlce 3.5 dlls to the bin directory. I am stuck at the error:
Access to the database file is not allowed. [ File name = ]
There actually is a file name in the connection string, and I set the permissions wide open on App_Data to test this.
What are the .net framework requirements for sqlce 3.5? I can't find this info anywhere.
I know sqlce 3.5 is not recommended for asp.net, but it is not the main site database but is used for a setup database utility to be installed for a windows app.
We have over 1000 terminals running CE 4.2 on an x86 cpu currently using SQLCE 3.1.
We have just upgraded to VS 2008 and found the projects have been upgraded to reference SQL CE 3.5 - this is great, as we wish to use things like TOP etc.
However, all the distributable packages only include CAB files for CE 4.2 for the ARM Processor, or CE 5.0 for the x86. Is there a CAB package available for CE 4.2 for the x86 CPU? (please...)
Even just the relevant .DLL files would be fine as we repackage them ourselves anyway.
Hi i developed Wm5 PPC application with sqlce database. i Create Cab file when i install in my HP WM5 PPC that will showe the Message sqlcewm.dll missed. Please tell me 1)sqlce30.ppc.wce5.armv4i 2)sqlce30.wce5.armv4i 3)sqlce20.ppc.wce5.armv4i..Please Help me
In my homegrown data layer, I added the ability to do Order By Clauses.
I do one query with an Order By clause (all 6 records in the table retrieved). Then I do a 2nd query without an Order By (36 of around 200 records in the table retrieved)
And I'm getting Native Exceptions.
ExceptionCode: 0xc00000000c (Null Pointer I believe) ExceptionAddresss: 0x00c3703c (looks to be in sqlcese30.dll) Reading: 0x00000005
I ran thru with the debugger, and am finding the error happening inside of a SQLDataReader.Read() call. It's trying to read the 14th of the 36 records that the query has found.
I am all but positive I'm not closing this database connection. The problem is happening while I'm looping off the reader data I just retrieved and in this query there was no ORDER BY clause.
I'm at a loss as to what to do about this. I'm not explicitly closing any database connections, and I'm getting the data right after performing the query.
I wrote a very simple C# console application which was designed to give us a rough idea on the performance and reliability of SQLCE (the source code without metrics has been posted to this group recently). What I've found is that there are major performance and reliability issues with SQLCE 3.0 as opposed to SQLCE 2.0. Whereas SQLCE 2.0 seems to be fairly consistent in terms of it's memory usage and the amount of time taken to insert rows into the table regardless of the size of the table (to a limit, after about 300,000 records it too has major performance issues), SQLCE 3.0 seems to slow down noticably and continually use more memory even after a few thousand records are inserted and actually crashes (consistently) after 25592 records are inserted!
What gives? Based on this it would seem that SQLCE 2.0 is far preferable for an unattended device that needs an uptime of over 30 days whilst constantly (several times per minute) inserting into the database.
Last month , I have made a utility named sqlce viewer to help me manage sqlce 3.5 beta version databases . The location is https://sourceforge.net/projects/sqlceviewer/
And now , I encounter a strange problem , need some help .
After user install this utility or run it standalone execute file .There has a error message poped before see the login in form . Even user has installed .net framework version 3.5 . And if user has installed visual studio 2008 beta2 ,this problem will not existed .
This utility depend on these components : 1)WPF 2).net framework 3.5 beta
I don't know what's the reason clearly . Anyone could give some advice are warm welcome.
I'm still having trouble deploying my Compact Edition application. The installation on other computers works, but if the program tries to start, i get the error message (translated from german):
"This Version of SQL Server 2005 Mobile Edition is not licencensed for productive use"
I always thought that there are no licence restriction with SQL Compact Edition. Strangely the the programm works on some computers... as I think on all computers where Visual Studio is installed.
Error Code: -2147467259 Message: A call to SQL Server Reconciler failed. [,,,,,] Minor Err. 29006 Source: Microsoft SQL Server 2000 Windows CE Edition
Any idea what could be the possible problem? I have been trying to search thru the internet for a resolution but most of the guides are very brief about the configuration of the merge replication in mssql2000 server. e.g. http://msdn.microsoft.com/msdnmag/issues/03/09/DataPoints/default.aspx This link above its recommended by Microsoft, but still doesn't really helps.
Does anybody have a step-by-step guide on configuring the merge replication in mssql? With diagrams preferred.
-OR-
Is there anything wrong with these codes:
oRpl.Publisher = "HANBIN"; // HANBIN is my database server name oRpl.PublisherLogin = "LHP"; oRpl.PublisherPassword = "<password>";
oRpl.InternetUrl = "http://hanbin/ssce/sscesa20.dll"; oRpl.InternetLogin = "IUSR_HANBIN"; oRpl.InternetPassword = ""; // do i need to put sth here?
oRpl.Subscriber = "CESubscriberTest"; // Any names will do? oRpl.Publication = "testdbpub"; oRpl.PublisherDatabase = "testdb";
I’m using SQLCE and SQL Server2000 to replicate to a Pocket PC running PPC MS windows 2002. What I want to know is it possible to update my cab file on the PDA remotely?
Is it possible to install the cab file trough SQLCE?
Hi, Can I use SqlCe v3.1 and SqlClient v2.0 in one .net application? (Note: I can't use RDA or replication. SqlClient read and write data in ON-LINE mode, SqlCe store and manipulate with data in OFF-LINE mode.)
MSDN has examples of deploying SQLCE privately for C# and VB.NET, but that doesn't seem to translate to C++. A .NET application just loads the assembly it needs from the local directory, but from what I can tell I need to use the OLE DB driver to use SQL CE in C++. The problem is that the OLE DB driver is a COM object that (presumably) needs to be registered.
Has anyone successfully used SQLCE from C++ without registering any COM objects? I'm thinking the only way to do that would be to call DllGetObject() on the DLL and get the object manually, but I've never done this so I'd hate to waste the time if there's an easier way, or if this won't work.
In the readme of v3.5, it mentions that if I use 3.5 to open a database file created by previous version, the version number will be updated to 3.5, so I opened it in c# and run some select statement, then I run the verify() command and here's what's returned:
it seems the database file did not get updated to v3.5. Unless it's returning original info.
Then, I take this same database file and try to access from another project with v3.5 runtime + Enterprise Library, and it generates this error:
An exception of type 'System.Data.SqlServerCe.SqlCeException' occurred in guardian.exe but was not handled in user code
Additional information: You are trying to access an older version of a SQL Server Compact Edition database. If this is a SQL Server CE 1.0 or 2.0 database, run upgrade.exe. If this is a SQL Server Compact Edition 3.0 or later database, run Compact / Repair. [ Db version = 3505053,Requested version = 3004180,File name = D:Dataceguardian.sdf ]
I am confused. Shouldn't 3.5 opens it up regardless of what version it is?
I am trying to soak in all this information regarding SQLCE and was hoping someone could set me off in the right direction.
Scenario: I have an Windows Mobile 5.0 data collection application that I need to sync with a desktop database. I will need the ability to sync 1 or more Pocket PC's with a desktop database.
Questions:
1.) Assuming I need to sync the data, is using a SQLCE database on the device AND the desktop a viable solution?
2.) If not, would my only other option be to use SQL Server Express (SQL Server is not an option, $$$)?
3.) Keeping simplicity in mind, what would be my best choice of syncing technology? RDA? Merge Replication? Microsoft Synchronization Services for ADO.NET?
Generally speaking, I want to know if YOU were starting from scratch, what combination of technologies would you use?
hi I am new in SQLCE and I am trying to run SQLCE SERVER... I have already downloaded the software and installed it as server on my computer... I have checked the services running on my system but could not find SQLCE server, I don't know what is wrong with it and don't know what to do with SQLCE server .. I will be glad if any one would tell me what to do... thanks.......
I was initially interested in building my small retail app on Framework 3.5, until just now when I saw the download size. I won't make a single sale with that as a prerequisite.
I would, however, like to use VS2008 for this. If I target Framework 2.0, will I still be able to use SQLCE v3.5? The new SET IDENTITY INSERT functionality is an absolute requirement. (Note: I haven't installed VS2008 yet--I'm still investigating options.)
I'm having a bit of a problem figuring out how to pass a dataset to sqlce to be appended to a table.
I'm using the CSVDataAdapter.dll to import from a csv file. I'm able to load the data into a dataset but from there I'm having my problem. Since the recordset is not from my table that I want to write, how can I pass the recordset for appending?
Code Snippet
Dim ds = New DataSet() da = New CSVDataAdapter(apppath + "DBmyfile.csv", True)
'Fills the recordset with CSV file information da.Fill(ds, "Newfile")
'display in grid Me.DataGrid1.DataSource = ds.Tables("Newfile")
Could I use - USING?
Code Snippet
Using cmd As New SqlCeCommand("Newfile", conn) cmd.CommandType = CommandType.TableDirect
'code to manipulate the resultset Using ds As SqlCeResultSet = cmd.ExecuteResultSet(ResultSetOptions.Updatable) End Using
Hi all, I am querying an SqlCe Database on my PDA and noticed that the device is slowly running out of memory every time I execute a query. I am using the following code:
public SqlCeDataReader ExecuteReader(string command, params SqlCeParameter[] commandParameters) { SqlCeDataReader reader = null; SqlCeCommand c = new SqlCeCommand(command, cn); try { for (int i = 0; i < commandParameters.Length; i++) c.Parameters.Add(commandParameters); reader = c.ExecuteReader(); } catch { // Release resources c.Parameters.Clear(); reader.Close(); throw; } c.Parameters.Clear(); return reader; }
This method is a part of my 'SqlCeHelper' class that I have written.
I noticed that when I reach the line reader = c.ExecuteReader() , the memory of my device decreases by about 1%. The reader is returned to a class which makes use of it and then disposes of it by calling reader.Close(); The connection to the database is also closed properly at some point, but memory never gets released. Memory gets only released when the application terminates.
I am wondering if I am doing something wrong by not disposing of some resources. Please help!