I developed a desktop application using C # and sql server compact 3.5
I have all the necessary dll files
- System.Data.SqlServerCe.dll
- sqlceca35.dll
- sqlcecompact35.dll
- sqlceer35EN.dll
- sqlceme35.dll
- sqlceoledb35.dll
- sqlceqp35.dll
- sqlcese35.dll
And deploy it during its operation without any errors on this PC, when I install the installation on the client machine, it will precisely insert the data into the .sdf database, as well as extract data for autocomplete.
When I want to extract data from it to fill in a combo box or network, it will generate an error
attempted to read write protected memory. this is often an indication that other memory is corrupt
Note. If I installed this setting on another computer that has VS 2008, it will work fine without any errors. Should I install something on the client PC?
I am also trying to build in VS2008:
Tools->Options Debugging->General uncheck option "Suppress JIT optimization on module load"
but the result will be the same.
Here is the class I used to store and retrieve data from db
class dataBase { private SqlCeDataAdapter ad; private SqlCeCommand cmd; private string StringdbFileName=("Data Source=" + System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\sp.sdf").Replace(@"file:\", ""); private SqlCeConnection coon; public dataBase() { coon = new SqlCeConnection(StringdbFileName); coon.Close(); } public int ExecuteSQL(string Query) { try { coon.Open(); cmd = new SqlCeCommand(); cmd.Connection = this.coon; cmd.CommandText = Query; return cmd.ExecuteNonQuery(); } catch (Exception ex) { throw ex; } finally { coon.Close(); } } public DataTable GetDataTable(string Query) { try { coon.Open(); DataTable dt = new DataTable(); cmd = new SqlCeCommand(); cmd.CommandText = Query; ad = new SqlCeDataAdapter(Query,coon); ad.Fill(dt); return dt; } catch (Exception ex) { throw ex; } finally { coon.Close(); } } public void FillComboBox(string Query, string DisplayMember,string ValueMember, ComboBox cmb) { try { coon.Open(); DataTable dt = new DataTable(); cmd = new SqlCeCommand(); cmd.CommandText = Query; ad = new SqlCeDataAdapter(Query, coon); ad.Fill(dt); cmb.DataSource = dt; cmb.DisplayMember = DisplayMember; cmb.ValueMember = ValueMember; } catch (Exception ex) { throw ex; } finally { coon.Close(); } } }
source share