Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Pocket PC Application
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro et .NET
Divers
Thread ID:
00891724
Message ID:
00892975
Vues:
25
I am in Visual Studio .NET 2003, and I use the SDE part of the .NET framework, which, if I understand correctly, is for developing mobile apps where the code runs on the device (as opposed to mobile apps developed using Mobile Toolkit, where the code runs on the server).
When I start the app from the VS.NET IDE, in debug mode, it presents two options for the target device: emulator (default), or Pocket PC 2002. The first one starts the emulator, the second will deploy the app on the PocketPC (you have to connect it first).
In emulator the xml files are not found.
On the Pocket, the ReadXml seems to work; however, when I add records I don't get an error, but there is no new data added to the xml....
Here is the code in the Save button (it is c# but it's very similar with the vb.net):
DataSet ds = new DataSet("ObfDS");

string lcPath = Path.GetDirectoryName.System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase.ToString());

string lcFullXsdName = Path.Combine(lcPath, "obf.xsd");
string lcFullXmlName = Path.Combine(lcPath, "obf.xml");

// read schema
if (File.Exists(lcFullXsdName))  // this returns false on emulator
   ds.ReadXml(lcFullXsdName);    // not executed on emulator

// read xml
if (File.Exists(lcFullXmlName))
   ds.ReadXml(lcFullXmlName);

// give a name to the table - not used
ds.Tables[0].TableName = "tObf";   // this errors on emulator

DataRow dr = ds.Tables[0].NewRow();
dr[0] = DateTime.Now.ToString();
dr[1] = DateTime.Now.TimeOfDay;
dr[2] = "3";
dr[3] = chkTlc.Checked.ToString();
dr[4] = txtSta1.Text;
dr[5] = txtSta2.Text;
dr[6] = txtStn.Text;
dr[7] = txtCar.Text;
dr[8] = txtFf.Text;
dr[9] = txtPf.Text;
dr[10] = txtZf.Text;
dr[11] = txtLoad.Text;

ds.Tables[0].Rows.Add(dr);
ds.AcceptChanges();
ds.WriteXml("obf.xml");

txtFf.Text = "0" ;
txtPf.Text = "0" ;
txtZf.Text = "0" ;
txtLoad.Text = "0" ;

MessageBox.Show(DateTime.Now.TimeOfDay + " inspection by " + txtSta1.Text + " on board "+ txtCar.Text +" leaving " + txtStn.Text + " was saved.", "Fare Inspection Saved");

lblMsg.Text = "Total Fare Checks: ";
On the Pocket, the code executes fine, I get the message at the end, but there is no data added. On the emulator, the xml/xsd files are not found.
Doru
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform