| Home | Forums | Reviews | Articles | Register |
![]() |
| Thread Tools | Rate Thread |
|
|
|
| |
|
Darren Shaffer
Guest
Posts: n/a
|
Salim,
So what you need are 14 new datasets. Assuming "ds" is the dataset that contains the 14 tables you want to split across individual datasets, do this 14 times: DataSet ds1 = new DataSet(); ds1.Tables.Add(ds.Tables[0]); ......ending with..... DataSet ds14 = new DataSet(); ds14.Tables.Add(ds.Tables[13]); Then save all 14 of the datasets you have created. - Darren "salim" <(E-Mail Removed)> wrote in message news:164BC48C-18CB-4027-AE65-(E-Mail Removed)... > Hi group, > > Am bit stuck again. > > well,I have a dataset with 14 tables,I return this dataset to my PocketPc > Device it's fine,surprisingly fast too..but now i want to split each table > in > this dataset into individual dataset so i can save it in xml on device for > later use.using ds.writexml method. below is the code snippet > > ds = objWebService1.RetrieveInitializeData() > > dt= ds .table1 > > dsLookup.Tables.Add(dt) <-- get error over here saying "Table already > belongs to this DataSet" > > Me.WriteToOffline > (dsLookup, "\ProgramFiles\HandIT2Sage\Data\UserOptions.xml") > > Basically i want to split the tables in the dataset into individual > datasets > > Any Ideas!!!! > > Regards > > Salim G Belim > > > |
|
||
|
||||
|
=?Utf-8?B?c2FsaW0=?=
Guest
Posts: n/a
|
Hi Darren,
thanks,but when i do ds1.Tables.Add(ds.Tables[0]); it gives me error ""Table already belongs to this DataSet" Regards Salim "Darren Shaffer" wrote: > Salim, > > So what you need are 14 new datasets. Assuming "ds" is the dataset that > contains the > 14 tables you want to split across individual datasets, do this 14 times: > > DataSet ds1 = new DataSet(); > ds1.Tables.Add(ds.Tables[0]); > > ......ending with..... > DataSet ds14 = new DataSet(); > ds14.Tables.Add(ds.Tables[13]); > > Then save all 14 of the datasets you have created. > - Darren > > "salim" <(E-Mail Removed)> wrote in message > news:164BC48C-18CB-4027-AE65-(E-Mail Removed)... > > Hi group, > > > > Am bit stuck again. > > > > well,I have a dataset with 14 tables,I return this dataset to my PocketPc > > Device it's fine,surprisingly fast too..but now i want to split each table > > in > > this dataset into individual dataset so i can save it in xml on device for > > later use.using ds.writexml method. below is the code snippet > > > > ds = objWebService1.RetrieveInitializeData() > > > > dt= ds .table1 > > > > dsLookup.Tables.Add(dt) <-- get error over here saying "Table already > > belongs to this DataSet" > > > > Me.WriteToOffline > > (dsLookup, "\ProgramFiles\HandIT2Sage\Data\UserOptions.xml") > > > > Basically i want to split the tables in the dataset into individual > > datasets > > > > Any Ideas!!!! > > > > Regards > > > > Salim G Belim > > > > > > > > > |
|
||
|
||||
|
Darren Shaffer
Guest
Posts: n/a
|
Sorry Salim, my mistake - once a DataTable is added to a DataSet, you can
remove it but the only way I know to de-attach it so that it's contents can be reused is to define a new DataTable as the Clone() of the existing one (gets the schema), iterate through the existing one, and insert each row into the new one, effectively performing a copy of the original DataTable. Once you've got the copy you can Remove() the old DataTable from the original DataSet. -Darren "salim" <(E-Mail Removed)> wrote in message news:B0BC6CA5-014A-4B90-9D15-(E-Mail Removed)... > Hi Darren, > > thanks,but when i do ds1.Tables.Add(ds.Tables[0]); > it gives me error ""Table already belongs to this DataSet" > > > Regards > Salim > > > "Darren Shaffer" wrote: > >> Salim, >> >> So what you need are 14 new datasets. Assuming "ds" is the dataset that >> contains the >> 14 tables you want to split across individual datasets, do this 14 times: >> >> DataSet ds1 = new DataSet(); >> ds1.Tables.Add(ds.Tables[0]); >> >> ......ending with..... >> DataSet ds14 = new DataSet(); >> ds14.Tables.Add(ds.Tables[13]); >> >> Then save all 14 of the datasets you have created. >> - Darren >> >> "salim" <(E-Mail Removed)> wrote in message >> news:164BC48C-18CB-4027-AE65-(E-Mail Removed)... >> > Hi group, >> > >> > Am bit stuck again. >> > >> > well,I have a dataset with 14 tables,I return this dataset to my >> > PocketPc >> > Device it's fine,surprisingly fast too..but now i want to split each >> > table >> > in >> > this dataset into individual dataset so i can save it in xml on device >> > for >> > later use.using ds.writexml method. below is the code snippet >> > >> > ds = objWebService1.RetrieveInitializeData() >> > >> > dt= ds .table1 >> > >> > dsLookup.Tables.Add(dt) <-- get error over here saying "Table >> > already >> > belongs to this DataSet" >> > >> > Me.WriteToOffline >> > (dsLookup, "\ProgramFiles\HandIT2Sage\Data\UserOptions.xml") >> > >> > Basically i want to split the tables in the dataset into individual >> > datasets >> > >> > Any Ideas!!!! >> > >> > Regards >> > >> > Salim G Belim >> > >> > >> > >> >> >> |
|
||
|
||||
|
Ilya Tumanov [MS]
Guest
Posts: n/a
|
You can't do that; DataTable can only belong to one DataSet.
Please remove DataTable from original DataSet before adding it to another one or clone it. Another solution would be to save all tables at ones by saving original DataSet to XML. That would preserve relations you might have (and its one line of code). Also make sure 'dsLookup' is not the same as 'ds' (as exception message suggests). Should they be different, you'll get an exception with the following message: "DataTable already belongs to another DataSet". Best regards, Ilya This posting is provided "AS IS" with no warranties, and confers no rights. -------------------- > Thread-Topic: DataSet Issues > thread-index: AcTXvLi+xKW/Rhr2Qk6Y3NWGmInE5A== > X-WBNR-Posting-Host: 213.40.196.128 > From: "=?Utf-8?B?c2FsaW0=?=" <(E-Mail Removed)> > Subject: DataSet Issues > Date: Wed, 1 Dec 2004 07:45:02 -0800 > Lines: 29 > Message-ID: <164BC48C-18CB-4027-AE65-(E-Mail Removed)> > MIME-Version: 1.0 > Content-Type: text/plain; > charset="Utf-8" > Content-Transfer-Encoding: 7bit > X-Newsreader: Microsoft CDO for Windows 2000 > Content-Class: urn:content-classes:message > Importance: normal > Priority: normal > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 > Newsgroups: microsoft.public.dotnet.framework.compactframework > NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29 > Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl > Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:66125 > X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework > > Hi group, > > Am bit stuck again. > > well,I have a dataset with 14 tables,I return this dataset to my PocketPc > Device it's fine,surprisingly fast too..but now i want to split each table in > this dataset into individual dataset so i can save it in xml on device for > later use.using ds.writexml method. below is the code snippet > > ds = objWebService1.RetrieveInitializeData() > > dt= ds .table1 > > dsLookup.Tables.Add(dt) <-- get error over here saying "Table already > belongs to this DataSet" > > Me.WriteToOffline > (dsLookup, "\ProgramFiles\HandIT2Sage\Data\UserOptions.xml") > > Basically i want to split the tables in the dataset into individual datasets > > Any Ideas!!!! > > Regards > > Salim G Belim > > > > |
|
||
|
||||
|
=?Utf-8?B?c2FsaW0=?=
Guest
Posts: n/a
|
Hi Guys,
Sorry couldn't catch up my own post ,it's seems time difference anyway i solve the probelm solution was i remove the table from dslookup and add to another dataset an surprisingly it works it seems the datatable is stored in dataset by reference. Dim dsFinal as new dataset ds = objWebService1.RetrieveInitializeData() dsLookup = ds dttbl_user_options = dsLookup.Tables(2) dsLookup.Tables.Remove(dttbl_user_options) dsFinal.Tables.Add(dttbl_user_options) Has any one used diffgram in compact framework (can we use it?),any articles/links to compare two dataset using diffgram? Regards Salim ""Ilya Tumanov [MS]"" wrote: > You can't do that; DataTable can only belong to one DataSet. > Please remove DataTable from original DataSet before adding it to another > one or clone it. > > Another solution would be to save all tables at ones by saving original > DataSet to XML. > That would preserve relations you might have (and its one line of code). > > Also make sure 'dsLookup' is not the same as 'ds' (as exception message > suggests). > Should they be different, you'll get an exception with the following > message: "DataTable already belongs to another DataSet". > > Best regards, > > Ilya > > This posting is provided "AS IS" with no warranties, and confers no rights. > > -------------------- > > Thread-Topic: DataSet Issues > > thread-index: AcTXvLi+xKW/Rhr2Qk6Y3NWGmInE5A== > > X-WBNR-Posting-Host: 213.40.196.128 > > From: "=?Utf-8?B?c2FsaW0=?=" <(E-Mail Removed)> > > Subject: DataSet Issues > > Date: Wed, 1 Dec 2004 07:45:02 -0800 > > Lines: 29 > > Message-ID: <164BC48C-18CB-4027-AE65-(E-Mail Removed)> > > MIME-Version: 1.0 > > Content-Type: text/plain; > > charset="Utf-8" > > Content-Transfer-Encoding: 7bit > > X-Newsreader: Microsoft CDO for Windows 2000 > > Content-Class: urn:content-classes:message > > Importance: normal > > Priority: normal > > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 > > Newsgroups: microsoft.public.dotnet.framework.compactframework > > NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29 > > Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl > > Xref: cpmsftngxa10.phx.gbl > microsoft.public.dotnet.framework.compactframework:66125 > > X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework > > > > Hi group, > > > > Am bit stuck again. > > > > well,I have a dataset with 14 tables,I return this dataset to my PocketPc > > Device it's fine,surprisingly fast too..but now i want to split each > table in > > this dataset into individual dataset so i can save it in xml on device > for > > later use.using ds.writexml method. below is the code snippet > > > > ds = objWebService1.RetrieveInitializeData() > > > > dt= ds .table1 > > > > dsLookup.Tables.Add(dt) <-- get error over here saying "Table > already > > belongs to this DataSet" > > > > Me.WriteToOffline > > (dsLookup, "\ProgramFiles\HandIT2Sage\Data\UserOptions.xml") > > > > Basically i want to split the tables in the dataset into individual > datasets > > > > Any Ideas!!!! > > > > Regards > > > > Salim G Belim > > > > > > > > > > |
|
||
|
||||
|
Ilya Tumanov [MS]
Guest
Posts: n/a
|
Yes, you can use diffgram in CF.
You should use overloads below and specify XmlWriteMode.DiffGram to save XML as diffgram. XmlReadMode.DiffGram can be specified for ReadXml, but it's optional as diffgram will be automatically recognized. Do not forget to load schema into the dataset first, diffgram mode needs schema to be loaded or data from XML will be ignored. public XmlReadMode ReadXml(XmlReader reader,XmlReadMode mode); public void WriteXml(XmlWriter writer,XmlWriteMode mode); As to comparing XML, it's not the best solution. Compare datasets instead if you have to do that. Best regards, Ilya This posting is provided "AS IS" with no warranties, and confers no rights. -------------------- > Thread-Topic: DataSet Issues > thread-index: AcTYUjI0y7WFmMm5QRGaf9OEUIHxUg== > X-WBNR-Posting-Host: 213.40.196.128 > From: "=?Utf-8?B?c2FsaW0=?=" <(E-Mail Removed)> > References: <164BC48C-18CB-4027-AE65-(E-Mail Removed)> <(E-Mail Removed)> > Subject: RE: DataSet Issues > Date: Thu, 2 Dec 2004 01:35:01 -0800 > Lines: 107 > Message-ID: <5F97C842-2669-4794-9CC7-(E-Mail Removed)> > MIME-Version: 1.0 > Content-Type: text/plain; > charset="Utf-8" > Content-Transfer-Encoding: 7bit > X-Newsreader: Microsoft CDO for Windows 2000 > Content-Class: urn:content-classes:message > Importance: normal > Priority: normal > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 > Newsgroups: microsoft.public.dotnet.framework.compactframework > NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29 > Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl > Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:66193 > X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework > > Hi Guys, > > Sorry couldn't catch up my own post ,it's seems time difference anyway i > solve the probelm > > solution was i remove the table from dslookup and add to another dataset an > surprisingly it works it seems the datatable is stored in dataset by > reference. > > Dim dsFinal as new dataset > > ds = objWebService1.RetrieveInitializeData() > dsLookup = ds > dttbl_user_options = dsLookup.Tables(2) > dsLookup.Tables.Remove(dttbl_user_options) > dsFinal.Tables.Add(dttbl_user_options) > > Has any one used diffgram in compact framework (can we use it?),any > articles/links to compare two dataset using diffgram? > > > Regards > Salim > > > ""Ilya Tumanov [MS]"" wrote: > > > You can't do that; DataTable can only belong to one DataSet. > > Please remove DataTable from original DataSet before adding it to another > > one or clone it. > > > > Another solution would be to save all tables at ones by saving original > > DataSet to XML. > > That would preserve relations you might have (and its one line of code). > > > > Also make sure 'dsLookup' is not the same as 'ds' (as exception message > > suggests). > > Should they be different, you'll get an exception with the following > > message: "DataTable already belongs to another DataSet". > > > > Best regards, > > > > Ilya > > > > This posting is provided "AS IS" with no warranties, and confers no rights. > > > > -------------------- > > > Thread-Topic: DataSet Issues > > > thread-index: AcTXvLi+xKW/Rhr2Qk6Y3NWGmInE5A== > > > X-WBNR-Posting-Host: 213.40.196.128 > > > From: "=?Utf-8?B?c2FsaW0=?=" <(E-Mail Removed)> > > > Subject: DataSet Issues > > > Date: Wed, 1 Dec 2004 07:45:02 -0800 > > > Lines: 29 > > > Message-ID: <164BC48C-18CB-4027-AE65-(E-Mail Removed)> > > > MIME-Version: 1.0 > > > Content-Type: text/plain; > > > charset="Utf-8" > > > Content-Transfer-Encoding: 7bit > > > X-Newsreader: Microsoft CDO for Windows 2000 > > > Content-Class: urn:content-classes:message > > > Importance: normal > > > Priority: normal > > > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 > > > Newsgroups: microsoft.public.dotnet.framework.compactframework > > > NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29 > > > Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl > > > Xref: cpmsftngxa10.phx.gbl > > microsoft.public.dotnet.framework.compactframework:66125 > > > X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework > > > > > > Hi group, > > > > > > Am bit stuck again. > > > > > > well,I have a dataset with 14 tables,I return this dataset to my PocketPc > > > Device it's fine,surprisingly fast too..but now i want to split each > > table in > > > this dataset into individual dataset so i can save it in xml on device > > for > > > later use.using ds.writexml method. below is the code snippet > > > > > > ds = objWebService1.RetrieveInitializeData() > > > > > > dt= ds .table1 > > > > > > dsLookup.Tables.Add(dt) <-- get error over here saying "Table > > already > > > belongs to this DataSet" > > > > > > Me.WriteToOffline > > > (dsLookup, "\ProgramFiles\HandIT2Sage\Data\UserOptions.xml") > > > > > > Basically i want to split the tables in the dataset into individual > > datasets > > > > > > Any Ideas!!!! > > > > > > Regards > > > > > > Salim G Belim > > > > > > > > > > > > > > > > > |
|
||
|
||||
|
=?Utf-8?B?c2FsaW0=?=
Guest
Posts: n/a
|
Hi Guys,
I managed to get diffgram working, but Again i have a question. Well,I bringing down typed dataset using webservice(offcourse i have to modify the webreference of webservice) and i need to save the dataset in xml as diffgram,so my code is below. Public Function writeXML(ByVal ds As DataSet, ByVal FileName As String, ByVal SchemaName As String) As Boolean Dim CatalogFile As FileInfo Dim dir As DirectoryInfo Dim stream As StreamWriter = Nothing Dim writer As XmlTextWriter = Nothing Dim isOk As Boolean Try 'Create application directory if it doesn’t exist dir = New DirectoryInfo("\Program Files\MySystem\Data") If (Not dir.Exists) Then dir.Create() End If stream = New StreamWriter(FileName) writer = New XmlTextWriter(stream) If (Not (ds.Tables.Count = 0)) Then ' Save out to file ds.WriteXml(writer, XmlWriteMode.DiffGram) 'write schema ds.WriteXmlSchema(SchemaName) End If isOk = True Catch ex As Exception isOk = False Finally If Not (stream Is Nothing) Then stream.Close() End If End Try Return isOk End Function End Class No my question is do i have to save both the schema and xml as i tried just saving the xml using diffgram when i view the xml it have no schema inside...just the <diffgr:diffgram xmlns:....... stuff><MyNew>... data </mynew></diffgr:diffgram > "NO Schema" so i had to save the schema seperately and then load the schema and xml using readxml to populate the dataset. Any ideas how to save the diffgram + data + schema in one single xml file??? Regards Salim ""Ilya Tumanov [MS]"" wrote: > Yes, you can use diffgram in CF. > You should use overloads below and specify XmlWriteMode.DiffGram to save > XML as diffgram. > XmlReadMode.DiffGram can be specified for ReadXml, but it's optional as > diffgram will be automatically recognized. > Do not forget to load schema into the dataset first, diffgram mode needs > schema to be loaded or data from XML will be ignored. > > public XmlReadMode ReadXml(XmlReader reader,XmlReadMode mode); > public void WriteXml(XmlWriter writer,XmlWriteMode mode); > > As to comparing XML, it's not the best solution. Compare datasets instead > if you have to do that. > > Best regards, > > Ilya > > This posting is provided "AS IS" with no warranties, and confers no rights. > > -------------------- > > Thread-Topic: DataSet Issues > > thread-index: AcTYUjI0y7WFmMm5QRGaf9OEUIHxUg== > > X-WBNR-Posting-Host: 213.40.196.128 > > From: "=?Utf-8?B?c2FsaW0=?=" <(E-Mail Removed)> > > References: <164BC48C-18CB-4027-AE65-(E-Mail Removed)> > <(E-Mail Removed)> > > Subject: RE: DataSet Issues > > Date: Thu, 2 Dec 2004 01:35:01 -0800 > > Lines: 107 > > Message-ID: <5F97C842-2669-4794-9CC7-(E-Mail Removed)> > > MIME-Version: 1.0 > > Content-Type: text/plain; > > charset="Utf-8" > > Content-Transfer-Encoding: 7bit > > X-Newsreader: Microsoft CDO for Windows 2000 > > Content-Class: urn:content-classes:message > > Importance: normal > > Priority: normal > > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 > > Newsgroups: microsoft.public.dotnet.framework.compactframework > > NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29 > > Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl > > Xref: cpmsftngxa10.phx.gbl > microsoft.public.dotnet.framework.compactframework:66193 > > X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework > > > > Hi Guys, > > > > Sorry couldn't catch up my own post ,it's seems time difference anyway i > > solve the probelm > > > > solution was i remove the table from dslookup and add to another dataset > an > > surprisingly it works it seems the datatable is stored in dataset by > > reference. > > > > Dim dsFinal as new dataset > > > > ds = objWebService1.RetrieveInitializeData() > > dsLookup = ds > > dttbl_user_options = dsLookup.Tables(2) > > dsLookup.Tables.Remove(dttbl_user_options) > > dsFinal.Tables.Add(dttbl_user_options) > > > > Has any one used diffgram in compact framework (can we use it?),any > > articles/links to compare two dataset using diffgram? > > > > > > Regards > > Salim > > > > > > ""Ilya Tumanov [MS]"" wrote: > > > > > You can't do that; DataTable can only belong to one DataSet. > > > Please remove DataTable from original DataSet before adding it to > another > > > one or clone it. > > > > > > Another solution would be to save all tables at ones by saving original > > > DataSet to XML. > > > That would preserve relations you might have (and its one line of code). > > > > > > Also make sure 'dsLookup' is not the same as 'ds' (as exception message > > > suggests). > > > Should they be different, you'll get an exception with the following > > > message: "DataTable already belongs to another DataSet". > > > > > > Best regards, > > > > > > Ilya > > > > > > This posting is provided "AS IS" with no warranties, and confers no > rights. > > > > > > -------------------- > > > > Thread-Topic: DataSet Issues > > > > thread-index: AcTXvLi+xKW/Rhr2Qk6Y3NWGmInE5A== > > > > X-WBNR-Posting-Host: 213.40.196.128 > > > > From: "=?Utf-8?B?c2FsaW0=?=" <(E-Mail Removed)> > > > > Subject: DataSet Issues > > > > Date: Wed, 1 Dec 2004 07:45:02 -0800 > > > > Lines: 29 > > > > Message-ID: <164BC48C-18CB-4027-AE65-(E-Mail Removed)> > > > > MIME-Version: 1.0 > > > > Content-Type: text/plain; > > > > charset="Utf-8" > > > > Content-Transfer-Encoding: 7bit > > > > X-Newsreader: Microsoft CDO for Windows 2000 > > > > Content-Class: urn:content-classes:message > > > > Importance: normal > > > > Priority: normal > > > > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 > > > > Newsgroups: microsoft.public.dotnet.framework.compactframework > > > > NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29 > > > > Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl > > > > Xref: cpmsftngxa10.phx.gbl > > > microsoft.public.dotnet.framework.compactframework:66125 > > > > X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework > > > > > > > > Hi group, > > > > > > > > Am bit stuck again. > > > > > > > > well,I have a dataset with 14 tables,I return this dataset to my > PocketPc > > > > Device it's fine,surprisingly fast too..but now i want to split each > > > table in > > > > this dataset into individual dataset so i can save it in xml on > device > > > for > > > > later use.using ds.writexml method. below is the code snippet > > > > > > > > ds = objWebService1.RetrieveInitializeData() > > > > > > > > dt= ds .table1 > > > > > > > > dsLookup.Tables.Add(dt) <-- get error over here saying "Table > > > already > > > > belongs to this DataSet" > > > > > > > > Me.WriteToOffline > > > > (dsLookup, "\ProgramFiles\HandIT2Sage\Data\UserOptions.xml") > > > > > > > > Basically i want to split the tables in the dataset into individual > > > datasets > > > > > > > > Any Ideas!!!! > > > > > > > > Regards > > > > > > > > Salim G Belim > > > > > > > > > > > > > > > > > > > > > > > > > > |
|
||
|
||||
|
Ilya Tumanov [MS]
Guest
Posts: n/a
|
You can do it by creating XmlTextWriter, writing a DataSet tag (say,
<DataSet>), appending schema using WriteXmlSchema(), appending data using WriteXml() with diffgram option and writing closing DataSet tag. No special processing would be needed to read the data; schema will be detected and loaded automatically, as well as diffgram format will be recognized. Best regards, Ilya This posting is provided "AS IS" with no warranties, and confers no rights. -------------------- > Thread-Topic: DataSet Issues > thread-index: AcTZG18RZoRjs0bJRZms7svecfKtaQ== > X-WBNR-Posting-Host: 213.40.196.128 > From: "=?Utf-8?B?c2FsaW0=?=" <(E-Mail Removed)> > References: <164BC48C-18CB-4027-AE65-(E-Mail Removed)> <(E-Mail Removed)> <5F97C842-2669-4794-9CC7-(E-Mail Removed)> <zFVy$(E-Mail Removed)> > Subject: RE: DataSet Issues > Date: Fri, 3 Dec 2004 01:35:05 -0800 > Lines: 232 > Message-ID: <6285AEA7-BA64-4699-AE8E-(E-Mail Removed)> > MIME-Version: 1.0 > Content-Type: text/plain; > charset="Utf-8" > Content-Transfer-Encoding: 8bit > X-Newsreader: Microsoft CDO for Windows 2000 > Content-Class: urn:content-classes:message > Importance: normal > Priority: normal > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 > Newsgroups: microsoft.public.dotnet.framework.compactframework > NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29 > Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl > Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:66268 > X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework > > Hi Guys, > > I managed to get diffgram working, but Again i have a question. > > Well,I bringing down typed dataset using webservice(offcourse i have to > modify the webreference of webservice) and i need to save the dataset in xml > as diffgram,so my code is below. > > Public Function writeXML(ByVal ds As DataSet, ByVal FileName As String, > ByVal SchemaName As String) As Boolean > > Dim CatalogFile As FileInfo > Dim dir As DirectoryInfo > > Dim stream As StreamWriter = Nothing > Dim writer As XmlTextWriter = Nothing > Dim isOk As Boolean > > Try > > 'Create application directory if it doesn’t exist > dir = New DirectoryInfo("\Program Files\MySystem\Data") > If (Not dir.Exists) Then > dir.Create() > End If > > stream = New StreamWriter(FileName) > writer = New XmlTextWriter(stream) > > If (Not (ds.Tables.Count = 0)) Then > ' Save out to file > ds.WriteXml(writer, XmlWriteMode.DiffGram) > 'write schema > ds.WriteXmlSchema(SchemaName) > > End If > > isOk = True > Catch ex As Exception > isOk = False > Finally > If Not (stream Is Nothing) Then > stream.Close() > End If > End Try > > Return isOk > > End Function > > End Class > > > No my question is do i have to save both the schema and xml as i tried just > saving the xml using diffgram when i view the xml it have no schema > inside...just the <diffgr:diffgram xmlns:....... stuff><MyNew>... data > </mynew></diffgr:diffgram > > > "NO Schema" so i had to save the schema seperately and then load the schema > and xml using readxml to populate the dataset. > > Any ideas how to save the diffgram + data + schema in one single xml file??? > > Regards > > Salim > > > ""Ilya Tumanov [MS]"" wrote: > > > Yes, you can use diffgram in CF. > > You should use overloads below and specify XmlWriteMode.DiffGram to save > > XML as diffgram. > > XmlReadMode.DiffGram can be specified for ReadXml, but it's optional as > > diffgram will be automatically recognized. > > Do not forget to load schema into the dataset first, diffgram mode needs > > schema to be loaded or data from XML will be ignored. > > > > public XmlReadMode ReadXml(XmlReader reader,XmlReadMode mode); > > public void WriteXml(XmlWriter writer,XmlWriteMode mode); > > > > As to comparing XML, it's not the best solution. Compare datasets instead > > if you have to do that. > > > > Best regards, > > > > Ilya > > > > This posting is provided "AS IS" with no warranties, and confers no rights. > > > > -------------------- > > > Thread-Topic: DataSet Issues > > > thread-index: AcTYUjI0y7WFmMm5QRGaf9OEUIHxUg== > > > X-WBNR-Posting-Host: 213.40.196.128 > > > From: "=?Utf-8?B?c2FsaW0=?=" <(E-Mail Removed)> > > > References: <164BC48C-18CB-4027-AE65-(E-Mail Removed)> > > <(E-Mail Removed)> > > > Subject: RE: DataSet Issues > > > Date: Thu, 2 Dec 2004 01:35:01 -0800 > > > Lines: 107 > > > Message-ID: <5F97C842-2669-4794-9CC7-(E-Mail Removed)> > > > MIME-Version: 1.0 > > > Content-Type: text/plain; > > > charset="Utf-8" > > > Content-Transfer-Encoding: 7bit > > > X-Newsreader: Microsoft CDO for Windows 2000 > > > Content-Class: urn:content-classes:message > > > Importance: normal > > > Priority: normal > > > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 > > > Newsgroups: microsoft.public.dotnet.framework.compactframework > > > NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29 > > > Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl > > > Xref: cpmsftngxa10.phx.gbl > > microsoft.public.dotnet.framework.compactframework:66193 > > > X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework > > > > > > Hi Guys, > > > > > > Sorry couldn't catch up my own post ,it's seems time difference anyway i > > > solve the probelm > > > > > > solution was i remove the table from dslookup and add to another dataset > > an > > > surprisingly it works it seems the datatable is stored in dataset by > > > reference. > > > > > > Dim dsFinal as new dataset > > > > > > ds = objWebService1.RetrieveInitializeData() > > > dsLookup = ds > > > dttbl_user_options = dsLookup.Tables(2) > > > dsLookup.Tables.Remove(dttbl_user_options) > > > dsFinal.Tables.Add(dttbl_user_options) > > > > > > Has any one used diffgram in compact framework (can we use it?),any > > > articles/links to compare two dataset using diffgram? > > > > > > > > > Regards > > > Salim > > > > > > > > > ""Ilya Tumanov [MS]"" wrote: > > > > > > > You can't do that; DataTable can only belong to one DataSet. > > > > Please remove DataTable from original DataSet before adding it to > > another > > > > one or clone it. > > > > > > > > Another solution would be to save all tables at ones by saving original > > > > DataSet to XML. > > > > That would preserve relations you might have (and its one line of code). > > > > > > > > Also make sure 'dsLookup' is not the same as 'ds' (as exception message > > > > suggests). > > > > Should they be different, you'll get an exception with the following > > > > message: "DataTable already belongs to another DataSet". > > > > > > > > Best regards, > > > > > > > > Ilya > > > > > > > > This posting is provided "AS IS" with no warranties, and confers no > > rights. > > > > > > > > -------------------- > > > > > Thread-Topic: DataSet Issues > > > > > thread-index: AcTXvLi+xKW/Rhr2Qk6Y3NWGmInE5A== > > > > > X-WBNR-Posting-Host: 213.40.196.128 > > > > > From: "=?Utf-8?B?c2FsaW0=?=" <(E-Mail Removed)> > > > > > Subject: DataSet Issues > > > > > Date: Wed, 1 Dec 2004 07:45:02 -0800 > > > > > Lines: 29 > > > > > Message-ID: <164BC48C-18CB-4027-AE65-(E-Mail Removed)> > > > > > MIME-Version: 1.0 > > > > > Content-Type: text/plain; > > > > > charset="Utf-8" > > > > > Content-Transfer-Encoding: 7bit > > > > > X-Newsreader: Microsoft CDO for Windows 2000 > > > > > Content-Class: urn:content-classes:message > > > > > Importance: normal > > > > > Priority: normal > > > > > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 > > > > > Newsgroups: microsoft.public.dotnet.framework.compactframework > > > > > NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29 > > > > > Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl > > > > > Xref: cpmsftngxa10.phx.gbl > > > > microsoft.public.dotnet.framework.compactframework:66125 > > > > > X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework > > > > > > > > > > Hi group, > > > > > > > > > > Am bit stuck again. > > > > > > > > > > well,I have a dataset with 14 tables,I return this dataset to my > > PocketPc > > > > > Device it's fine,surprisingly fast too..but now i want to split each > > > > table in > > > > > this dataset into individual dataset so i can save it in xml on > > device > > > > for > > > > > later use.using ds.writexml method. below is the code snippet > > > > > > > > > > ds = objWebService1.RetrieveInitializeData() > > > > > > > > > > dt= ds .table1 > > > > > > > > > > dsLookup.Tables.Add(dt) <-- get error over here saying "Table > > > > already > > > > > belongs to this DataSet" > > > > > > > > > > Me.WriteToOffline > > > > > (dsLookup, "\ProgramFiles\HandIT2Sage\Data\UserOptions.xml") > > > > > > > > > > Basically i want to split the tables in the dataset into individual > > > > datasets > > > > > > > > > > Any Ideas!!!! > > > > > > > > > > Regards > > > > > > > > > > Salim G Belim > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
|
||
|
||||
|
=?Utf-8?B?c2FsaW0=?=
Guest
Posts: n/a
|
Hi Ilya,
It would be great if you can show me a sample code :-)) Regards Salim ""Ilya Tumanov [MS]"" wrote: > You can do it by creating XmlTextWriter, writing a DataSet tag (say, > <DataSet>), appending schema using WriteXmlSchema(), appending data using > WriteXml() with diffgram option and writing closing DataSet tag. No special > processing would be needed to read the data; schema will be detected and > loaded automatically, as well as diffgram format will be recognized. > > Best regards, > > Ilya > > > This posting is provided "AS IS" with no warranties, and confers no rights. > -------------------- > > Thread-Topic: DataSet Issues > > thread-index: AcTZG18RZoRjs0bJRZms7svecfKtaQ== > > X-WBNR-Posting-Host: 213.40.196.128 > > From: "=?Utf-8?B?c2FsaW0=?=" <(E-Mail Removed)> > > References: <164BC48C-18CB-4027-AE65-(E-Mail Removed)> > <(E-Mail Removed)> > <5F97C842-2669-4794-9CC7-(E-Mail Removed)> > <zFVy$(E-Mail Removed)> > > Subject: RE: DataSet Issues > > Date: Fri, 3 Dec 2004 01:35:05 -0800 > > Lines: 232 > > Message-ID: <6285AEA7-BA64-4699-AE8E-(E-Mail Removed)> > > MIME-Version: 1.0 > > Content-Type: text/plain; > > charset="Utf-8" > > Content-Transfer-Encoding: 8bit > > X-Newsreader: Microsoft CDO for Windows 2000 > > Content-Class: urn:content-classes:message > > Importance: normal > > Priority: normal > > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 > > Newsgroups: microsoft.public.dotnet.framework.compactframework > > NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29 > > Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl > > Xref: cpmsftngxa10.phx.gbl > microsoft.public.dotnet.framework.compactframework:66268 > > X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework > > > > Hi Guys, > > > > I managed to get diffgram working, but Again i have a question. > > > > Well,I bringing down typed dataset using webservice(offcourse i have to > > modify the webreference of webservice) and i need to save the dataset in > xml > > as diffgram,so my code is below. > > > > Public Function writeXML(ByVal ds As DataSet, ByVal FileName As String, > > ByVal SchemaName As String) As Boolean > > > > Dim CatalogFile As FileInfo > > Dim dir As DirectoryInfo > > > > Dim stream As StreamWriter = Nothing > > Dim writer As XmlTextWriter = Nothing > > Dim isOk As Boolean > > > > Try > > > > 'Create application directory if it doesn’t exist > > dir = New DirectoryInfo("\Program Files\MySystem\Data") > > If (Not dir.Exists) Then > > dir.Create() > > End If > > > > stream = New StreamWriter(FileName) > > writer = New XmlTextWriter(stream) > > > > If (Not (ds.Tables.Count = 0)) Then > > ' Save out to file > > ds.WriteXml(writer, XmlWriteMode.DiffGram) > > 'write schema > > ds.WriteXmlSchema(SchemaName) > > > > End If > > > > isOk = True > > Catch ex As Exception > > isOk = False > > Finally > > If Not (stream Is Nothing) Then > > stream.Close() > > End If > > End Try > > > > Return isOk > > > > End Function > > > > End Class > > > > > > No my question is do i have to save both the schema and xml as i tried > just > > saving the xml using diffgram when i view the xml it have no schema > > inside...just the <diffgr:diffgram xmlns:....... stuff><MyNew>... data > > </mynew></diffgr:diffgram > > > > > "NO Schema" so i had to save the schema seperately and then load the > schema > > and xml using readxml to populate the dataset. > > > > Any ideas how to save the diffgram + data + schema in one single xml > file??? > > > > Regards > > > > Salim > > > > > > ""Ilya Tumanov [MS]"" wrote: > > > > > Yes, you can use diffgram in CF. > > > You should use overloads below and specify XmlWriteMode.DiffGram to > save > > > XML as diffgram. > > > XmlReadMode.DiffGram can be specified for ReadXml, but it's optional as > > > diffgram will be automatically recognized. > > > Do not forget to load schema into the dataset first, diffgram mode > needs > > > schema to be loaded or data from XML will be ignored. > > > > > > public XmlReadMode ReadXml(XmlReader reader,XmlReadMode mode); > > > public void WriteXml(XmlWriter writer,XmlWriteMode mode); > > > > > > As to comparing XML, it's not the best solution. Compare datasets > instead > > > if you have to do that. > > > > > > Best regards, > > > > > > Ilya > > > > > > This posting is provided "AS IS" with no warranties, and confers no > rights. > > > > > > -------------------- > > > > Thread-Topic: DataSet Issues > > > > thread-index: AcTYUjI0y7WFmMm5QRGaf9OEUIHxUg== > > > > X-WBNR-Posting-Host: 213.40.196.128 > > > > From: "=?Utf-8?B?c2FsaW0=?=" <(E-Mail Removed)> > > > > References: <164BC48C-18CB-4027-AE65-(E-Mail Removed)> > > > <(E-Mail Removed)> > > > > Subject: RE: DataSet Issues > > > > Date: Thu, 2 Dec 2004 01:35:01 -0800 > > > > Lines: 107 > > > > Message-ID: <5F97C842-2669-4794-9CC7-(E-Mail Removed)> > > > > MIME-Version: 1.0 > > > > Content-Type: text/plain; > > > > charset="Utf-8" > > > > Content-Transfer-Encoding: 7bit > > > > X-Newsreader: Microsoft CDO for Windows 2000 > > > > Content-Class: urn:content-classes:message > > > > Importance: normal > > > > Priority: normal > > > > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 > > > > Newsgroups: microsoft.public.dotnet.framework.compactframework > > > > NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29 > > > > Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl > > > > Xref: cpmsftngxa10.phx.gbl > > > microsoft.public.dotnet.framework.compactframework:66193 > > > > X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework > > > > > > > > Hi Guys, > > > > > > > > Sorry couldn't catch up my own post ,it's seems time difference > anyway i > > > > solve the probelm > > > > > > > > solution was i remove the table from dslookup and add to another > dataset > > > an > > > > surprisingly it works it seems the datatable is stored in dataset by > > > > reference. > > > > > > > > Dim dsFinal as new dataset > > > > > > > > ds = objWebService1.RetrieveInitializeData() > > > > dsLookup = ds > > > > dttbl_user_options = dsLookup.Tables(2) > > > > dsLookup.Tables.Remove(dttbl_user_options) > > > > dsFinal.Tables.Add(dttbl_user_options) > > > > > > > > Has any one used diffgram in compact framework (can we use it?),any > > > > articles/links to compare two dataset using diffgram? > > > > > > > > > > > > Regards > > > > Salim > > > > > > > > > > > > ""Ilya Tumanov [MS]"" wrote: > > > > > > > > > You can't do that; DataTable can only belong to one DataSet. > > > > > Please remove DataTable from original DataSet before adding it to > > > another > > > > > one or clone it. > > > > > > > > > > Another solution would be to save all tables at ones by saving > original > > > > > DataSet to XML. > > > > > That would preserve relations you might have (and its one line of > code). > > > > > > > > > > Also make sure 'dsLookup' is not the same as 'ds' (as exception > message > > > > > suggests). > > > > > Should they be different, you'll get an exception with the > following > > > > > message: "DataTable already belongs to another DataSet". > > > > > > > > > > Best regards, > > > > > > > > > > Ilya > > > > > > > > > > This posting is provided "AS IS" with no warranties, and confers no > > > rights. > > > > > > > > > > -------------------- > > > > > > Thread-Topic: DataSet Issues > > > > > > thread-index: AcTXvLi+xKW/Rhr2Qk6Y3NWGmInE5A== > > > > > > X-WBNR-Posting-Host: 213.40.196.128 > > > > > > From: "=?Utf-8?B?c2FsaW0=?=" <(E-Mail Removed)> > > > > > > Subject: DataSet Issues > > > > > > Date: Wed, 1 Dec 2004 07:45:02 -0800 > > > > > > Lines: 29 > > > > > > Message-ID: <164BC48C-18CB-4027-AE65-(E-Mail Removed)> > > > > > > MIME-Version: 1.0 > > > > > > Content-Type: text/plain; > > > > > > charset="Utf-8" > > > > > > Content-Transfer-Encoding: 7bit > > > > > > X-Newsreader: Microsoft CDO for Windows 2000 > > > > > > Content-Class: urn:content-classes:message > > > > > > Importance: normal > > > > > > Priority: normal > > > > > > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 > > > > > > Newsgroups: microsoft.public.dotnet.framework.compactframework > > > > > > NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29 > > > > > > Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl > > > > > > Xref: cpmsftngxa10.phx.gbl > > > > > microsoft.public.dotnet.framework.compactframework:66125 > > > > > > X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework > > > > > > > > > > > > Hi group, > > > > > > > > > > > > Am bit stuck again. > > > > > > > > > > > > well,I have a dataset with 14 tables,I return this dataset to my > > > PocketPc > > > > > > Device it's fine,surprisingly fast too..but now i want to split > each > > > > > table in > > > > > > this dataset into individual dataset so i can save it in xml on > > > device > > > > > for > > > > > > later use.using ds.writexml method. below is the code snippet > > > > > > > > > > > > ds = objWebService1.RetrieveInitializeData() > > > > > > > > > > > > dt= ds .table1 > > > > > > > > > > > > dsLookup.Tables.Add(dt) <-- get error over here saying > "Table > > > > > already > > > > > > belongs to this DataSet" > > > > > > > > > > > > Me.WriteToOffline > > > > > > (dsLookup, "\ProgramFiles\HandIT2Sage\Data\UserOptions.xml") > > > > > > > > > > > > Basically i want to split the tables in the dataset into > individual > > > > > datasets > > > > > > > > > > > > Any Ideas!!!! > > > > > > > > > > > > Regards > > > > > > > > > > > > Salim G Belim > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
|
||
|
||||
|
|
|
| |
![]() |
| Thread Tools | |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Dataset issues | Chris | Microsoft VB .NET | 0 | 13th Oct 2006 08:54 PM |
| 2.0 dataset issues - again | GaryDean | Microsoft ASP .NET | 8 | 27th Mar 2006 05:32 PM |
| Dataset Merge Issues | =?Utf-8?B?V2hpc2t5Um9tZW8=?= | Microsoft Dot NET Framework Forms | 0 | 10th Dec 2005 08:46 PM |
| DataSet issues | Beri Tamas | Microsoft Dot NET Compact Framework | 13 | 6th Jan 2005 03:03 PM |
| webservice class inherite DataSet and client generate the force dataset issues | miller chen | Microsoft C# .NET | 0 | 18th Jul 2003 09:20 AM |
Powered by vBulletin®. Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2010, Crawlability, Inc. |




