You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, download files, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!
If you have any problems with the registration process or your account login, please contact contact us.
I am attempting to either
a) Find an effective, efficient, easy to use way of converting mobile .sdf files to an Excel file, or
b) Find info on how to write a program using C# to do this.
I have already begun to write a program in C# to take an already synced mobile database, and convert it to an Excel file. I am using Visual Studio 2005 C#, along with the sql Server Compact Edition. I have included all of the .dll's necessary, however, when I attempt to open the connection, I am getting the following error:
System.BadImageFormatException: An attempt was made to laod a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
at System.Data.SqlServerCe.NativeMethods.DllAddRef(). ..etc
Here is what my code looks like:
Code:
private void btnConvert_Click(object sender, EventArgs e)
{
try
{
string loc = "Info.sdf";
if (File.Exists(loc))
{
SqlCeConnection conn = new SqlCeConnection(loc);
conn.Open();
SqlCeCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT * FROM Info";
SqlCeDataReader dr = cmd.ExecuteReader();
}
}
catch (Exception exc)
{
MessageBox.Show(exc.ToString());
}
}
It won't even get passed creating the connection. Anyone know why it may be doing this? I have been stuck on this for some time now. Any help would be greatly appreciated!