| Home | Forums | Reviews | Articles | Register |
![]() |
| Thread Tools | Rate Thread |
|
|
|
| |
|
Ilya Tumanov [MS]
Guest
Posts: n/a
|
You can't load XML file because relative paths are not supported on CE.
Full path needs to be specified. If your XML is in the same folder as your EXE, you can use this to determine the path to your application. That would allow you to construct a full path to the XML file. http://msdn.microsoft.com/library/de...us/dncfhowto/h tml/HOWTOExecutingAppPath.asp Best regards, Ilya This posting is provided "AS IS" with no warranties, and confers no rights. -------------------- > Reply-To: "David Fúnez" <(E-Mail Removed)> > From: "David Fúnez" <(E-Mail Removed)> > Subject: Datagrid doesn't show XML data > Date: Tue, 28 Dec 2004 09:12:40 -0600 > Lines: 70 > Organization: Income > X-Priority: 3 > X-MSMail-Priority: Normal > X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 > X-RFC2646: Format=Flowed; Original > Message-ID: <(E-Mail Removed)> > Newsgroups: microsoft.public.dotnet.framework.compactframework > NNTP-Posting-Host: 205-240-200-112.reverse.cablecolor.hn 205.240.200.112 > Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11 .phx.gbl > Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:67627 > X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework > > I have a little APP for an iPAQ that runs Ok but it does not show any > record, the problem is with the XML File as shown. > > The APP is a DataGrid and two Buttons, one to save data an one to exit the > App. > > So, any help will be wellcome. > > **** The Code ***** > Dim dsLibros As DataSet > Dim dtPrestados As DataTable > Dim xmlFile As String = "Libros.xml" > > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles MyBase.Load > dtPrestados = New DataTable("prestados") > dtPrestados.Columns.Add("Id", GetType(Integer)) > dtPrestados.Columns.Add("Titulo", GetType(String)) > dtPrestados.Columns.Add("prestadosA", GetType(String)) > dtPrestados.Columns.Add("Fecha", GetType(Date)) > dtPrestados.Columns.Add("Devuelto", GetType(Boolean)) > > With dtPrestados.Columns("id") > .AutoIncrement = True > .AutoIncrementSeed = 1 > End With > > dsLibros = New DataSet("Libros") > dsLibros.Tables.Add(dtPrestados) > > dgLibros.DataSource = dsLibros.Tables(0) ' that's Ok, it shows the > columns > > ******* Mi problem is here, if i use this routine: > > If File.Exists(xmlFile) Then > dsLibros.ReadXml(xmlFile) > Else > MsgBox("File doesn't exists") > End If > > ******* shows the File doesn't exists Message, > > ******* if i put this line: dsLibros.ReadXml(xmlFile) **** out of the > routine like this > > *** dgLibros.DataSource = dsLibros.Tables(0) > *** dsLibros.ReadXml(xmlFile) > > *** it lounches an error > > End Sub > > Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles btnExit.Click > Me.Close() > End Sub > > Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles btnSave.Click > dsLibros.WriteXml(xmlFile) > End Sub > > > -- > David Fúnez > Tegucigalpa, Honduras > > > > |
|
||
|
||||
|
=?Utf-8?B?QWxleCBZYWtobmluIFtNVlBd?=
Guest
Posts: n/a
|
The Windows CE doesn't have a notion of current directory, so when accessing
files you must provide a full path. -- Alex Yakhnin, .NET CF MVP www.intelliprog.com www.opennetcf.org My blog: http://blog.opennetcf.org/ayakhnin "David Fúnez" wrote: > I have a little APP for an iPAQ that runs Ok but it does not show any > record, the problem is with the XML File as shown. > > The APP is a DataGrid and two Buttons, one to save data an one to exit the > App. > > So, any help will be wellcome. > > **** The Code ***** > Dim dsLibros As DataSet > Dim dtPrestados As DataTable > Dim xmlFile As String = "Libros.xml" > > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles MyBase.Load > dtPrestados = New DataTable("prestados") > dtPrestados.Columns.Add("Id", GetType(Integer)) > dtPrestados.Columns.Add("Titulo", GetType(String)) > dtPrestados.Columns.Add("prestadosA", GetType(String)) > dtPrestados.Columns.Add("Fecha", GetType(Date)) > dtPrestados.Columns.Add("Devuelto", GetType(Boolean)) > > With dtPrestados.Columns("id") > .AutoIncrement = True > .AutoIncrementSeed = 1 > End With > > dsLibros = New DataSet("Libros") > dsLibros.Tables.Add(dtPrestados) > > dgLibros.DataSource = dsLibros.Tables(0) ' that's Ok, it shows the > columns > > ******* Mi problem is here, if i use this routine: > > If File.Exists(xmlFile) Then > dsLibros.ReadXml(xmlFile) > Else > MsgBox("File doesn't exists") > End If > > ******* shows the File doesn't exists Message, > > ******* if i put this line: dsLibros.ReadXml(xmlFile) **** out of the > routine like this > > *** dgLibros.DataSource = dsLibros.Tables(0) > *** dsLibros.ReadXml(xmlFile) > > *** it lounches an error > > End Sub > > Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles btnExit.Click > Me.Close() > End Sub > > Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles btnSave.Click > dsLibros.WriteXml(xmlFile) > End Sub > > > -- > David Fúnez > Tegucigalpa, Honduras > > > > |
|
||
|
||||
|
David Fúnez
Guest
Posts: n/a
|
OK;
I've added this to get the path, but it still doesn't find ten XML File: Dim path As String path = System.IO.Path.GetDirectoryName( _ System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) MessageBox.Show(path & "\" & xmlFile) If File.Exists(path & "\" & xmlFile) Then dsLibros.ReadXml(path & "\" & xmlFile) Else MsgBox("no encontró el archivo") End If ********************** This File "Libros.xml" is in [C:\DotNet\iPAQ] folder and is added to my project. The result folder is "\Program Files\iPAQ" at the end of the compile shows "Libros.xml" has been copied, but it doesn't show where. -- David Fúnez Tegucigalpa, Honduras "David Fúnez" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)... >I have a little APP for an iPAQ that runs Ok but it does not show any > record, the problem is with the XML File as shown. > > The APP is a DataGrid and two Buttons, one to save data an one to exit the > App. > > So, any help will be wellcome. > > **** The Code ***** > Dim dsLibros As DataSet > Dim dtPrestados As DataTable > Dim xmlFile As String = "Libros.xml" > > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles MyBase.Load > dtPrestados = New DataTable("prestados") > dtPrestados.Columns.Add("Id", GetType(Integer)) > dtPrestados.Columns.Add("Titulo", GetType(String)) > dtPrestados.Columns.Add("prestadosA", GetType(String)) > dtPrestados.Columns.Add("Fecha", GetType(Date)) > dtPrestados.Columns.Add("Devuelto", GetType(Boolean)) > > With dtPrestados.Columns("id") > .AutoIncrement = True > .AutoIncrementSeed = 1 > End With > > dsLibros = New DataSet("Libros") > dsLibros.Tables.Add(dtPrestados) > > dgLibros.DataSource = dsLibros.Tables(0) ' that's Ok, it shows the > columns > > ******* Mi problem is here, if i use this routine: > > If File.Exists(xmlFile) Then > dsLibros.ReadXml(xmlFile) > Else > MsgBox("File doesn't exists") > End If > > ******* shows the File doesn't exists Message, > > ******* if i put this line: dsLibros.ReadXml(xmlFile) **** out of the > routine like this > > *** dgLibros.DataSource = dsLibros.Tables(0) > *** dsLibros.ReadXml(xmlFile) > > *** it lounches an error > > End Sub > > Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles btnExit.Click > Me.Close() > End Sub > > Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles btnSave.Click > dsLibros.WriteXml(xmlFile) > End Sub > > > -- > David Fúnez > Tegucigalpa, Honduras > > > |
|
||
|
||||
|
David Fúnez
Guest
Posts: n/a
|
I tried This:
dsLibros.ReadXml("\Program Files\iPAQ\libros.xml") Now it doesn't show any error, but doesn't show any data in the DataGrid. Any help. -- David Fúnez Tegucigalpa, Honduras "David Fúnez" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)... >I have a little APP for an iPAQ that runs Ok but it does not show any > record, the problem is with the XML File as shown. > > The APP is a DataGrid and two Buttons, one to save data an one to exit the > App. > > So, any help will be wellcome. > > **** The Code ***** > Dim dsLibros As DataSet > Dim dtPrestados As DataTable > Dim xmlFile As String = "Libros.xml" > > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles MyBase.Load > dtPrestados = New DataTable("prestados") > dtPrestados.Columns.Add("Id", GetType(Integer)) > dtPrestados.Columns.Add("Titulo", GetType(String)) > dtPrestados.Columns.Add("prestadosA", GetType(String)) > dtPrestados.Columns.Add("Fecha", GetType(Date)) > dtPrestados.Columns.Add("Devuelto", GetType(Boolean)) > > With dtPrestados.Columns("id") > .AutoIncrement = True > .AutoIncrementSeed = 1 > End With > > dsLibros = New DataSet("Libros") > dsLibros.Tables.Add(dtPrestados) > > dgLibros.DataSource = dsLibros.Tables(0) ' that's Ok, it shows the > columns > > ******* Mi problem is here, if i use this routine: > > If File.Exists(xmlFile) Then > dsLibros.ReadXml(xmlFile) > Else > MsgBox("File doesn't exists") > End If > > ******* shows the File doesn't exists Message, > > ******* if i put this line: dsLibros.ReadXml(xmlFile) **** out of the > routine like this > > *** dgLibros.DataSource = dsLibros.Tables(0) > *** dsLibros.ReadXml(xmlFile) > > *** it lounches an error > > End Sub > > Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles btnExit.Click > Me.Close() > End Sub > > Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles btnSave.Click > dsLibros.WriteXml(xmlFile) > End Sub > > > -- > David Fúnez > Tegucigalpa, Honduras > > > |
|
||
|
||||
|
Ilya Tumanov [MS]
Guest
Posts: n/a
|
Do you have any data in the XML? If you do, it has to match your schema.
Print out number of rows to see if data has been loaded. It's also a good idea to try it on desktop first. Best regards, Ilya This posting is provided "AS IS" with no warranties, and confers no rights. -------------------- > Reply-To: "David Fúnez" <(E-Mail Removed)> > From: "David Fúnez" <(E-Mail Removed)> > References: <(E-Mail Removed)> > Subject: Re: Datagrid doesn't show XML data > Date: Tue, 28 Dec 2004 15:50:12 -0600 > Lines: 87 > Organization: Income > X-Priority: 3 > X-MSMail-Priority: Normal > X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 > X-RFC2646: Format=Flowed; Response > Message-ID: <(E-Mail Removed)> > Newsgroups: microsoft.public.dotnet.framework.compactframework > NNTP-Posting-Host: 205-240-200-116.reverse.cablecolor.hn 205.240.200.116 > Path: cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11 .phx.gbl > Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:67657 > X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework > > I tried This: > > dsLibros.ReadXml("\Program Files\iPAQ\libros.xml") > > Now it doesn't show any error, but doesn't show any data in the DataGrid. > > Any help. > > -- > David Fúnez > Tegucigalpa, Honduras > > > "David Fúnez" <(E-Mail Removed)> wrote in message > news:(E-Mail Removed)... > >I have a little APP for an iPAQ that runs Ok but it does not show any > > record, the problem is with the XML File as shown. > > > > The APP is a DataGrid and two Buttons, one to save data an one to exit the > > App. > > > > So, any help will be wellcome. > > > > **** The Code ***** > > Dim dsLibros As DataSet > > Dim dtPrestados As DataTable > > Dim xmlFile As String = "Libros.xml" > > > > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As > > System.EventArgs) Handles MyBase.Load > > dtPrestados = New DataTable("prestados") > > dtPrestados.Columns.Add("Id", GetType(Integer)) > > dtPrestados.Columns.Add("Titulo", GetType(String)) > > dtPrestados.Columns.Add("prestadosA", GetType(String)) > > dtPrestados.Columns.Add("Fecha", GetType(Date)) > > dtPrestados.Columns.Add("Devuelto", GetType(Boolean)) > > > > With dtPrestados.Columns("id") > > .AutoIncrement = True > > .AutoIncrementSeed = 1 > > End With > > > > dsLibros = New DataSet("Libros") > > dsLibros.Tables.Add(dtPrestados) > > > > dgLibros.DataSource = dsLibros.Tables(0) ' that's Ok, it shows the > > columns > > > > ******* Mi problem is here, if i use this routine: > > > > If File.Exists(xmlFile) Then > > dsLibros.ReadXml(xmlFile) > > Else > > MsgBox("File doesn't exists") > > End If > > > > ******* shows the File doesn't exists Message, > > > > ******* if i put this line: dsLibros.ReadXml(xmlFile) **** out of the > > routine like this > > > > *** dgLibros.DataSource = dsLibros.Tables(0) > > *** dsLibros.ReadXml(xmlFile) > > > > *** it lounches an error > > > > End Sub > > > > Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As > > System.EventArgs) Handles btnExit.Click > > Me.Close() > > End Sub > > > > Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As > > System.EventArgs) Handles btnSave.Click > > dsLibros.WriteXml(xmlFile) > > End Sub > > > > > > -- > > David Fúnez > > Tegucigalpa, Honduras > > > > > > > > > |
|
||
|
||||
|
David Fúnez
Guest
Posts: n/a
|
Yes, the Xml file has data, but i have no created a Xsd file. ¿do i need
it?. First i tried in desktop mode, and works very well. Thanks on advance. -- David Fúnez Tegucigalpa, Honduras ""Ilya Tumanov [MS]"" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)... > Do you have any data in the XML? If you do, it has to match your schema. > Print out number of rows to see if data has been loaded. > It's also a good idea to try it on desktop first. > > Best regards, > > Ilya > > This posting is provided "AS IS" with no warranties, and confers no > rights. > -------------------- >> Reply-To: "David Fúnez" <(E-Mail Removed)> >> From: "David Fúnez" <(E-Mail Removed)> >> References: <(E-Mail Removed)> >> Subject: Re: Datagrid doesn't show XML data >> Date: Tue, 28 Dec 2004 15:50:12 -0600 >> Lines: 87 >> Organization: Income >> X-Priority: 3 >> X-MSMail-Priority: Normal >> X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 >> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 >> X-RFC2646: Format=Flowed; Response >> Message-ID: <(E-Mail Removed)> >> Newsgroups: microsoft.public.dotnet.framework.compactframework >> NNTP-Posting-Host: 205-240-200-116.reverse.cablecolor.hn 205.240.200.116 >> Path: > cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11 > phx.gbl >> Xref: cpmsftngxa10.phx.gbl > microsoft.public.dotnet.framework.compactframework:67657 >> X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework >> >> I tried This: >> >> dsLibros.ReadXml("\Program Files\iPAQ\libros.xml") >> >> Now it doesn't show any error, but doesn't show any data in the DataGrid. >> >> Any help. >> >> -- >> David Fúnez >> Tegucigalpa, Honduras >> >> >> "David Fúnez" <(E-Mail Removed)> wrote in message >> news:(E-Mail Removed)... >> >I have a little APP for an iPAQ that runs Ok but it does not show any >> > record, the problem is with the XML File as shown. >> > >> > The APP is a DataGrid and two Buttons, one to save data an one to exit > the >> > App. >> > >> > So, any help will be wellcome. >> > >> > **** The Code ***** >> > Dim dsLibros As DataSet >> > Dim dtPrestados As DataTable >> > Dim xmlFile As String = "Libros.xml" >> > >> > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As >> > System.EventArgs) Handles MyBase.Load >> > dtPrestados = New DataTable("prestados") >> > dtPrestados.Columns.Add("Id", GetType(Integer)) >> > dtPrestados.Columns.Add("Titulo", GetType(String)) >> > dtPrestados.Columns.Add("prestadosA", GetType(String)) >> > dtPrestados.Columns.Add("Fecha", GetType(Date)) >> > dtPrestados.Columns.Add("Devuelto", GetType(Boolean)) >> > >> > With dtPrestados.Columns("id") >> > .AutoIncrement = True >> > .AutoIncrementSeed = 1 >> > End With >> > >> > dsLibros = New DataSet("Libros") >> > dsLibros.Tables.Add(dtPrestados) >> > >> > dgLibros.DataSource = dsLibros.Tables(0) ' that's Ok, it shows > the >> > columns >> > >> > ******* Mi problem is here, if i use this routine: >> > >> > If File.Exists(xmlFile) Then >> > dsLibros.ReadXml(xmlFile) >> > Else >> > MsgBox("File doesn't exists") >> > End If >> > >> > ******* shows the File doesn't exists Message, >> > >> > ******* if i put this line: dsLibros.ReadXml(xmlFile) **** out of > the >> > routine like this >> > >> > *** dgLibros.DataSource = dsLibros.Tables(0) >> > *** dsLibros.ReadXml(xmlFile) >> > >> > *** it lounches an error >> > >> > End Sub >> > >> > Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As >> > System.EventArgs) Handles btnExit.Click >> > Me.Close() >> > End Sub >> > >> > Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As >> > System.EventArgs) Handles btnSave.Click >> > dsLibros.WriteXml(xmlFile) >> > End Sub >> > >> > >> > -- >> > David Fúnez >> > Tegucigalpa, Honduras >> > >> > >> > >> >> >> > |
|
||
|
||||
|
Ilya Tumanov [MS]
Guest
Posts: n/a
|
Do you mean this very code (with path correction) works on a desktop?
Or was a similar project with, say, typed dataset? If you do this after ReadXml(): MessageBox.Show(dsLibros.Tables(0).Rows.Count.ToString()) Is number in a message box above zero? As to XSD file, you can load it into empty DataSet instead of creating schema programmatically (which is also fine as long as it matches XML): dsLibros = New DataSet() dsLibros.ReadXmlSchema ("FULL_PATH_TO_XSD_FILE") 'Creates all tables and columns according to schema file. dsLibros.ReadXml ("FULL_PATH_TO_XML_FILE") 'Loads data, XML needs to match XSD schema loaded before. dgLibros.DataSource = dsLibros.Tables(0) 'Show data in the grid. The benefit is what you can tweak the schema easily. Best regards, Ilya This posting is provided "AS IS" with no warranties, and confers no rights. -------------------- > Reply-To: "David Fúnez" <(E-Mail Removed)> > From: "David Fúnez" <(E-Mail Removed)> > References: <(E-Mail Removed)> <(E-Mail Removed)> <(E-Mail Removed)> > Subject: Re: Datagrid doesn't show XML data > Date: Tue, 28 Dec 2004 16:47:21 -0600 > Lines: 141 > Organization: Income > X-Priority: 3 > X-MSMail-Priority: Normal > X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 > X-RFC2646: Format=Flowed; Original > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 > Message-ID: <(E-Mail Removed)> > Newsgroups: microsoft.public.dotnet.framework.compactframework > NNTP-Posting-Host: 205-240-200-123.reverse.cablecolor.hn 205.240.200.123 > Path: cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15 .phx.gbl > Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.compactframework:67663 > X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework > > Yes, the Xml file has data, but i have no created a Xsd file. ¿do i need > it?. > > First i tried in desktop mode, and works very well. > > Thanks on advance. > > -- > David Fúnez > Tegucigalpa, Honduras > > > ""Ilya Tumanov [MS]"" <(E-Mail Removed)> wrote in message > news:(E-Mail Removed)... > > Do you have any data in the XML? If you do, it has to match your schema. > > Print out number of rows to see if data has been loaded. > > It's also a good idea to try it on desktop first. > > > > Best regards, > > > > Ilya > > > > This posting is provided "AS IS" with no warranties, and confers no > > rights. > > -------------------- > >> Reply-To: "David Fúnez" <(E-Mail Removed)> > >> From: "David Fúnez" <(E-Mail Removed)> > >> References: <(E-Mail Removed)> > >> Subject: Re: Datagrid doesn't show XML data > >> Date: Tue, 28 Dec 2004 15:50:12 -0600 > >> Lines: 87 > >> Organization: Income > >> X-Priority: 3 > >> X-MSMail-Priority: Normal > >> X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 > >> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 > >> X-RFC2646: Format=Flowed; Response > >> Message-ID: <(E-Mail Removed)> > >> Newsgroups: microsoft.public.dotnet.framework.compactframework > >> NNTP-Posting-Host: 205-240-200-116.reverse.cablecolor.hn 205.240.200.116 > >> Path: > > cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11 > > phx.gbl > >> Xref: cpmsftngxa10.phx.gbl > > microsoft.public.dotnet.framework.compactframework:67657 > >> X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework > >> > >> I tried This: > >> > >> dsLibros.ReadXml("\Program Files\iPAQ\libros.xml") > >> > >> Now it doesn't show any error, but doesn't show any data in the DataGrid. > >> > >> Any help. > >> > >> -- > >> David Fúnez > >> Tegucigalpa, Honduras > >> > >> > >> "David Fúnez" <(E-Mail Removed)> wrote in message > >> news:(E-Mail Removed)... > >> >I have a little APP for an iPAQ that runs Ok but it does not show any > >> > record, the problem is with the XML File as shown. > >> > > >> > The APP is a DataGrid and two Buttons, one to save data an one to exit > > the > >> > App. > >> > > >> > So, any help will be wellcome. > >> > > >> > **** The Code ***** > >> > Dim dsLibros As DataSet > >> > Dim dtPrestados As DataTable > >> > Dim xmlFile As String = "Libros.xml" > >> > > >> > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As > >> > System.EventArgs) Handles MyBase.Load > >> > dtPrestados = New DataTable("prestados") > >> > dtPrestados.Columns.Add("Id", GetType(Integer)) > >> > dtPrestados.Columns.Add("Titulo", GetType(String)) > >> > dtPrestados.Columns.Add("prestadosA", GetType(String)) > >> > dtPrestados.Columns.Add("Fecha", GetType(Date)) > >> > dtPrestados.Columns.Add("Devuelto", GetType(Boolean)) > >> > > >> > With dtPrestados.Columns("id") > >> > .AutoIncrement = True > >> > .AutoIncrementSeed = 1 > >> > End With > >> > > >> > dsLibros = New DataSet("Libros") > >> > dsLibros.Tables.Add(dtPrestados) > >> > > >> > dgLibros.DataSource = dsLibros.Tables(0) ' that's Ok, it shows > > the > >> > columns > >> > > >> > ******* Mi problem is here, if i use this routine: > >> > > >> > If File.Exists(xmlFile) Then > >> > dsLibros.ReadXml(xmlFile) > >> > Else > >> > MsgBox("File doesn't exists") > >> > End If > >> > > >> > ******* shows the File doesn't exists Message, > >> > > >> > ******* if i put this line: dsLibros.ReadXml(xmlFile) **** out of > > the > >> > routine like this > >> > > >> > *** dgLibros.DataSource = dsLibros.Tables(0) > >> > *** dsLibros.ReadXml(xmlFile) > >> > > >> > *** it lounches an error > >> > > >> > End Sub > >> > > >> > Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As > >> > System.EventArgs) Handles btnExit.Click > >> > Me.Close() > >> > End Sub > >> > > >> > Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As > >> > System.EventArgs) Handles btnSave.Click > >> > dsLibros.WriteXml(xmlFile) > >> > End Sub > >> > > >> > > >> > -- > >> > David Fúnez > >> > Tegucigalpa, Honduras > >> > > >> > > >> > > >> > >> > >> > > > > > |
|
||
|
||||
|
David Fúnez
Guest
Posts: n/a
|
i mean that this code works ok in the Windows Form App i built at First,
this one is other project form Smart Devices. I'll try what tou say... thanks a lot. -- David Fúnez Tegucigalpa, Honduras ""Ilya Tumanov [MS]"" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)... > Do you mean this very code (with path correction) works on a desktop? > Or was a similar project with, say, typed dataset? > > If you do this after ReadXml(): > MessageBox.Show(dsLibros.Tables(0).Rows.Count.ToString()) > Is number in a message box above zero? > > As to XSD file, you can load it into empty DataSet instead of creating > schema programmatically (which is also fine as long as it matches XML): > > dsLibros = New DataSet() > dsLibros.ReadXmlSchema ("FULL_PATH_TO_XSD_FILE") 'Creates all tables and > columns according to schema file. > dsLibros.ReadXml ("FULL_PATH_TO_XML_FILE") 'Loads data, XML needs to match > XSD schema loaded before. > dgLibros.DataSource = dsLibros.Tables(0) 'Show data in the grid. > > The benefit is what you can tweak the schema easily. > > Best regards, > > Ilya > > This posting is provided "AS IS" with no warranties, and confers no > rights. > > -------------------- >> Reply-To: "David Fúnez" <(E-Mail Removed)> >> From: "David Fúnez" <(E-Mail Removed)> >> References: <(E-Mail Removed)> > <(E-Mail Removed)> > <(E-Mail Removed)> >> Subject: Re: Datagrid doesn't show XML data >> Date: Tue, 28 Dec 2004 16:47:21 -0600 >> Lines: 141 >> Organization: Income >> X-Priority: 3 >> X-MSMail-Priority: Normal >> X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 >> X-RFC2646: Format=Flowed; Original >> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 >> Message-ID: <(E-Mail Removed)> >> Newsgroups: microsoft.public.dotnet.framework.compactframework >> NNTP-Posting-Host: 205-240-200-123.reverse.cablecolor.hn 205.240.200.123 >> Path: > cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15 > phx.gbl >> Xref: cpmsftngxa10.phx.gbl > microsoft.public.dotnet.framework.compactframework:67663 >> X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework >> >> Yes, the Xml file has data, but i have no created a Xsd file. ¿do i need >> it?. >> >> First i tried in desktop mode, and works very well. >> >> Thanks on advance. >> >> -- >> David Fúnez >> Tegucigalpa, Honduras >> >> >> ""Ilya Tumanov [MS]"" <(E-Mail Removed)> wrote in message >> news:(E-Mail Removed)... >> > Do you have any data in the XML? If you do, it has to match your >> > schema. >> > Print out number of rows to see if data has been loaded. >> > It's also a good idea to try it on desktop first. >> > >> > Best regards, >> > >> > Ilya >> > >> > This posting is provided "AS IS" with no warranties, and confers no >> > rights. >> > -------------------- >> >> Reply-To: "David Fúnez" <(E-Mail Removed)> >> >> From: "David Fúnez" <(E-Mail Removed)> >> >> References: <(E-Mail Removed)> >> >> Subject: Re: Datagrid doesn't show XML data >> >> Date: Tue, 28 Dec 2004 15:50:12 -0600 >> >> Lines: 87 >> >> Organization: Income >> >> X-Priority: 3 >> >> X-MSMail-Priority: Normal >> >> X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 >> >> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 >> >> X-RFC2646: Format=Flowed; Response >> >> Message-ID: <(E-Mail Removed)> >> >> Newsgroups: microsoft.public.dotnet.framework.compactframework >> >> NNTP-Posting-Host: 205-240-200-116.reverse.cablecolor.hn > 205.240.200.116 >> >> Path: >> > > cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11 >> > phx.gbl >> >> Xref: cpmsftngxa10.phx.gbl >> > microsoft.public.dotnet.framework.compactframework:67657 >> >> X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework >> >> >> >> I tried This: >> >> >> >> dsLibros.ReadXml("\Program Files\iPAQ\libros.xml") >> >> >> >> Now it doesn't show any error, but doesn't show any data in the > DataGrid. >> >> >> >> Any help. >> >> >> >> -- >> >> David Fúnez >> >> Tegucigalpa, Honduras >> >> >> >> >> >> "David Fúnez" <(E-Mail Removed)> wrote in message >> >> news:(E-Mail Removed)... >> >> >I have a little APP for an iPAQ that runs Ok but it does not show any >> >> > record, the problem is with the XML File as shown. >> >> > >> >> > The APP is a DataGrid and two Buttons, one to save data an one to > exit >> > the >> >> > App. >> >> > >> >> > So, any help will be wellcome. >> >> > >> >> > **** The Code ***** >> >> > Dim dsLibros As DataSet >> >> > Dim dtPrestados As DataTable >> >> > Dim xmlFile As String = "Libros.xml" >> >> > >> >> > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As >> >> > System.EventArgs) Handles MyBase.Load >> >> > dtPrestados = New DataTable("prestados") >> >> > dtPrestados.Columns.Add("Id", GetType(Integer)) >> >> > dtPrestados.Columns.Add("Titulo", GetType(String)) >> >> > dtPrestados.Columns.Add("prestadosA", GetType(String)) >> >> > dtPrestados.Columns.Add("Fecha", GetType(Date)) >> >> > dtPrestados.Columns.Add("Devuelto", GetType(Boolean)) >> >> > >> >> > With dtPrestados.Columns("id") >> >> > .AutoIncrement = True >> >> > .AutoIncrementSeed = 1 >> >> > End With >> >> > >> >> > dsLibros = New DataSet("Libros") >> >> > dsLibros.Tables.Add(dtPrestados) >> >> > >> >> > dgLibros.DataSource = dsLibros.Tables(0) ' that's Ok, it >> >> > shows >> > the >> >> > columns >> >> > >> >> > ******* Mi problem is here, if i use this routine: >> >> > >> >> > If File.Exists(xmlFile) Then >> >> > dsLibros.ReadXml(xmlFile) >> >> > Else >> >> > MsgBox("File doesn't exists") >> >> > End If >> >> > >> >> > ******* shows the File doesn't exists Message, >> >> > >> >> > ******* if i put this line: dsLibros.ReadXml(xmlFile) **** out > of >> > the >> >> > routine like this >> >> > >> >> > *** dgLibros.DataSource = dsLibros.Tables(0) >> >> > *** dsLibros.ReadXml(xmlFile) >> >> > >> >> > *** it lounches an error >> >> > >> >> > End Sub >> >> > >> >> > Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e > As >> >> > System.EventArgs) Handles btnExit.Click >> >> > Me.Close() >> >> > End Sub >> >> > >> >> > Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e > As >> >> > System.EventArgs) Handles btnSave.Click >> >> > dsLibros.WriteXml(xmlFile) >> >> > End Sub >> >> > >> >> > >> >> > -- >> >> > David Fúnez >> >> > Tegucigalpa, Honduras >> >> > >> >> > >> >> > >> >> >> >> >> >> >> > >> >> >> > |
|
||
|
||||
|
David Fúnez
Guest
Posts: n/a
|
This shows 0.
dsLibros.ReadXml(path & "\" & xmlFile) MessageBox.Show(dsLibros.Tables(0).Rows.Count.ToString()) -- David Fúnez Tegucigalpa, Honduras "David Fúnez" <(E-Mail Removed)> wrote in message news:%23ypa$(E-Mail Removed)... >i mean that this code works ok in the Windows Form App i built at First, >this one is other project form Smart Devices. > > I'll try what tou say... thanks a lot. > > -- > David Fúnez > Tegucigalpa, Honduras > > > ""Ilya Tumanov [MS]"" <(E-Mail Removed)> wrote in message > news:(E-Mail Removed)... >> Do you mean this very code (with path correction) works on a desktop? >> Or was a similar project with, say, typed dataset? >> >> If you do this after ReadXml(): >> MessageBox.Show(dsLibros.Tables(0).Rows.Count.ToString()) >> Is number in a message box above zero? >> >> As to XSD file, you can load it into empty DataSet instead of creating >> schema programmatically (which is also fine as long as it matches XML): >> >> dsLibros = New DataSet() >> dsLibros.ReadXmlSchema ("FULL_PATH_TO_XSD_FILE") 'Creates all tables and >> columns according to schema file. >> dsLibros.ReadXml ("FULL_PATH_TO_XML_FILE") 'Loads data, XML needs to >> match >> XSD schema loaded before. >> dgLibros.DataSource = dsLibros.Tables(0) 'Show data in the grid. >> >> The benefit is what you can tweak the schema easily. >> >> Best regards, >> >> Ilya >> >> This posting is provided "AS IS" with no warranties, and confers no >> rights. >> >> -------------------- >>> Reply-To: "David Fúnez" <(E-Mail Removed)> >>> From: "David Fúnez" <(E-Mail Removed)> >>> References: <(E-Mail Removed)> >> <(E-Mail Removed)> >> <(E-Mail Removed)> >>> Subject: Re: Datagrid doesn't show XML data >>> Date: Tue, 28 Dec 2004 16:47:21 -0600 >>> Lines: 141 >>> Organization: Income >>> X-Priority: 3 >>> X-MSMail-Priority: Normal >>> X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 >>> X-RFC2646: Format=Flowed; Original >>> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 >>> Message-ID: <(E-Mail Removed)> >>> Newsgroups: microsoft.public.dotnet.framework.compactframework >>> NNTP-Posting-Host: 205-240-200-123.reverse.cablecolor.hn 205.240.200.123 >>> Path: >> cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15 >> phx.gbl >>> Xref: cpmsftngxa10.phx.gbl >> microsoft.public.dotnet.framework.compactframework:67663 >>> X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework >>> >>> Yes, the Xml file has data, but i have no created a Xsd file. ¿do i need >>> it?. >>> >>> First i tried in desktop mode, and works very well. >>> >>> Thanks on advance. >>> >>> -- >>> David Fúnez >>> Tegucigalpa, Honduras >>> >>> >>> ""Ilya Tumanov [MS]"" <(E-Mail Removed)> wrote in message >>> news:(E-Mail Removed)... >>> > Do you have any data in the XML? If you do, it has to match your >>> > schema. >>> > Print out number of rows to see if data has been loaded. >>> > It's also a good idea to try it on desktop first. >>> > >>> > Best regards, >>> > >>> > Ilya >>> > >>> > This posting is provided "AS IS" with no warranties, and confers no >>> > rights. >>> > -------------------- >>> >> Reply-To: "David Fúnez" <(E-Mail Removed)> >>> >> From: "David Fúnez" <(E-Mail Removed)> >>> >> References: <(E-Mail Removed)> >>> >> Subject: Re: Datagrid doesn't show XML data >>> >> Date: Tue, 28 Dec 2004 15:50:12 -0600 >>> >> Lines: 87 >>> >> Organization: Income >>> >> X-Priority: 3 >>> >> X-MSMail-Priority: Normal >>> >> X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 >>> >> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 >>> >> X-RFC2646: Format=Flowed; Response >>> >> Message-ID: <(E-Mail Removed)> >>> >> Newsgroups: microsoft.public.dotnet.framework.compactframework >>> >> NNTP-Posting-Host: 205-240-200-116.reverse.cablecolor.hn >> 205.240.200.116 >>> >> Path: >>> > >> cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11 >>> > phx.gbl >>> >> Xref: cpmsftngxa10.phx.gbl >>> > microsoft.public.dotnet.framework.compactframework:67657 >>> >> X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework >>> >> >>> >> I tried This: >>> >> >>> >> dsLibros.ReadXml("\Program Files\iPAQ\libros.xml") >>> >> >>> >> Now it doesn't show any error, but doesn't show any data in the >> DataGrid. >>> >> >>> >> Any help. >>> >> >>> >> -- >>> >> David Fúnez >>> >> Tegucigalpa, Honduras >>> >> >>> >> >>> >> "David Fúnez" <(E-Mail Removed)> wrote in message >>> >> news:(E-Mail Removed)... >>> >> >I have a little APP for an iPAQ that runs Ok but it does not show >>> >> >any >>> >> > record, the problem is with the XML File as shown. >>> >> > >>> >> > The APP is a DataGrid and two Buttons, one to save data an one to >> exit >>> > the >>> >> > App. >>> >> > >>> >> > So, any help will be wellcome. >>> >> > >>> >> > **** The Code ***** >>> >> > Dim dsLibros As DataSet >>> >> > Dim dtPrestados As DataTable >>> >> > Dim xmlFile As String = "Libros.xml" >>> >> > >>> >> > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As >>> >> > System.EventArgs) Handles MyBase.Load >>> >> > dtPrestados = New DataTable("prestados") >>> >> > dtPrestados.Columns.Add("Id", GetType(Integer)) >>> >> > dtPrestados.Columns.Add("Titulo", GetType(String)) >>> >> > dtPrestados.Columns.Add("prestadosA", GetType(String)) >>> >> > dtPrestados.Columns.Add("Fecha", GetType(Date)) >>> >> > dtPrestados.Columns.Add("Devuelto", GetType(Boolean)) >>> >> > >>> >> > With dtPrestados.Columns("id") >>> >> > .AutoIncrement = True >>> >> > .AutoIncrementSeed = 1 >>> >> > End With >>> >> > >>> >> > dsLibros = New DataSet("Libros") >>> >> > dsLibros.Tables.Add(dtPrestados) >>> >> > >>> >> > dgLibros.DataSource = dsLibros.Tables(0) ' that's Ok, it >>> >> > shows >>> > the >>> >> > columns >>> >> > >>> >> > ******* Mi problem is here, if i use this routine: >>> >> > >>> >> > If File.Exists(xmlFile) Then >>> >> > dsLibros.ReadXml(xmlFile) >>> >> > Else >>> >> > MsgBox("File doesn't exists") >>> >> > End If >>> >> > >>> >> > ******* shows the File doesn't exists Message, >>> >> > >>> >> > ******* if i put this line: dsLibros.ReadXml(xmlFile) **** out >> of >>> > the >>> >> > routine like this >>> >> > >>> >> > *** dgLibros.DataSource = dsLibros.Tables(0) >>> >> > *** dsLibros.ReadXml(xmlFile) >>> >> > >>> >> > *** it lounches an error >>> >> > >>> >> > End Sub >>> >> > >>> >> > Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e >> As >>> >> > System.EventArgs) Handles btnExit.Click >>> >> > Me.Close() >>> >> > End Sub >>> >> > >>> >> > Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e >> As >>> >> > System.EventArgs) Handles btnSave.Click >>> >> > dsLibros.WriteXml(xmlFile) >>> >> > End Sub >>> >> > >>> >> > >>> >> > -- >>> >> > David Fúnez >>> >> > Tegucigalpa, Honduras >>> >> > >>> >> > >>> >> > >>> >> >>> >> >>> >> >>> > >>> >>> >>> >> > > |
|
||
|
||||
|
|
|
| |
![]() |
| Thread Tools | |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| RightToLeft DataGrid doesn't show Negative numbers correctly | Uri Dor | Microsoft Dot NET Framework Forms | 0 | 4th Mar 2004 12:06 PM |
| DataGrid's CurrentRowIndex doesn't show new row's index. | Thomas Berg | Microsoft Dot NET Framework Forms | 0 | 9th Feb 2004 03:17 AM |
| show data without datagrid | Mike | Microsoft C# .NET | 1 | 1st Feb 2004 01:36 PM |
| datagrid doesn't reflect changes in data (unless datatable) | Peter Bladh | Microsoft Dot NET Compact Framework | 4 | 15th Jan 2004 09:28 PM |
| DataGrid Update Doesn't Show Immediately | Wickwack | Microsoft ASP .NET | 0 | 23rd Jul 2003 12:49 AM |
Powered by vBulletin®. Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2010, Crawlability, Inc. |




