I am using C#.net and SQL Server
I have developed an xml schema.
I would like to retrieve fields from my table tblDetails stored in the SQL DB and append the XML file. <RecordNum></RecordNum><CarNum></CarNum><Date></Date>
On a different form i would like to open the XML file again and this time append the XML file with fields from table tblPatient
<PatientID></PatientID><Title></Title><FName></FName><SName></SName><Address></Address><TownSuburb></TownSuburb><State></State><MaleFemale></MaleFemale><DOB></DOB>
Using ADO.NET I can create XML files with the dataset but not append.
I would also like to click a button and remove all inserted fields within the XML schema, or would it be easier to create new.
<?xml version="1.0" standalone="yes" ?>
- <NewDataSet>
- <Table><RecordNum></RecordNum><CarNum></CarNum><Date></Date><PatientID></PatientID><Title></Title><FName></FName><SName></SName><Address></Address><TownSuburb></TownSuburb><State></State><MaleFemale></MaleFemale><DOB></DOB></Table></NewDataSet>
SqlCeConnection cn = null;
try
{
cn = new SqlCeConnection("Data Source = \\Program Files\\Database\\patientREADYmobile.sdf; Password=test");
cn.Open();
SqlCeCommand cmd = cn.CreateCommand();
cmd.CommandText
cmd.CommandText = "select * from tblDetails, tblPatient where tblPTOPHCRRecord.RecordNum = '"+ Tab.RecordNumber +"' and tblPatientDetails.RecordNum = tblPTOPHCRRecord.RecordNum";
SqlCeDataAdapter da = new SqlCeDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
// write dataset contents to an xml file by calling WriteXml method
ds.WriteXml("\\Program Files\\Database\\PHCRDetails.xml");
Thanks
adam