I need to import data from csv-file to sdf-database (SQL CE 2.0).
When I copy the csv-file to my mobile device, it thakes more than 1 hour. The sdf-File later has a size of 20MB.
If I create an sdf-File (SQL CE 3.0) on the desktop, it just thakes a few minutes.
Is it possible to create an sdf-File (SQL CE 2.0) on the desktop legally?
My clients don't want to by the SQL-Server, because it should be an inexpensive solution.
Or is there another way to create the database with more performance?
ThanksIt is a good idea to generate the database on the desktop, zip and transfer to device, and then unzip. This is however, only possible with SQL CE 3.1. What prevents you from using 3.1 instead of 2.0?|||No, it's not possible with SQL CE 2.0 That problem was solved in SQL CE 3.1.
Keep in mind support for SQL CE 2.0 is soon to run out, it's a very good idea to stay away from it. Don’t find yourself in the situation CEDB users found themselves after it was “suddenly” (after about 3 years advanced announcement) dropped from WM 5.0.
|||On the device, there is windows CE 4.2 and compact Framework 2.0 installed.
My application is created with Visual Studio 2003.
If I install sqlce 3.1 on the device, then I am able to open an sdf file (that I created on the desktop) whith Query Analyzer. But my application still needs sdf files of version 2.0. What must be changed in my project, that i can work whith the new sdf-Files?
|||You'd need to upgrade to VS 2005 and recompile your application with NETCF V2/SQL CE 3.1. Code probably would remain unchanged.
Existing databases (if any) must be converted from SQL CE 2.0 to SQL CE 3.x format.
Note VS 2005 does not officially support CE 4.2 devices but it works in most cases. You can get trial version and see if it works for you.
|||
OK, i upgradet to VS2005 and compiled my application again.
When I start the application now on device, i get the following error:
System.StackOverflowException in System.Windows.Forms.dll
This error dosn't occur in my old VS2003 project.
The debugger couldn't show me the line, where the error occurs. I just know, that it is not in my code.
So i did some tests and i determined, that the error didn't occur when I show a MessageBox before a special statement. The error will even not occur when i execute the statement later in the code.
Code Snippet
lblUserName.Text = MyDataSet.get_UserName(UserNumber);// here, i get the user name to the UserNumber
//from the database
panel1.Enabled = false;
txtUsr.Enabled = false;
lblUserName.Visible = true;
// MessageBox.Show("test"); //if I show this MessageBox, the error will not occur!
btnExit.Visible = false; //if I execute this line 4 lines later, the error will also not occur
btn_Yes.Visible = true;
btn_No.Visible = true;
label1.Visible = true;
label2.Visible = true;
this.Focus();
public string get_UserName(string UserNumber)
{
string returnwert = "";
this.Make_DB_Connection();
try
{
SqlCeCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT username FROM AllUser WHERE usernr = '"+UserNumber+"';";
cmd.ExecuteNonQuery();
SqlCeDataReader rdr = cmd.ExecuteReader();
rdr.Read();
returnwert = rdr.GetString(0);
}
catch(Exception){}
Close_DB_Connection()
return returnwert;
}
public void Close_DB_Connection()
{
if(conn.State == ConnectionState.Open)
{
conn.Close();
}
}
|||You should use stack trace on the exception to determine where infinite recursion occurred.
Most likely some code in event handlers you trigger by changing UI stuff.
|||I Found the error and anything is working fine now.
Thank you verry much for your help!!!
No comments:
Post a Comment