SetDataBinding

  • Thread starter Thread starter Marco
  • Start date Start date
M

Marco

Hi

Im trying to upload a xml file to a datagrid.
SetDataBinding works on the .net framework, but im
getting erros on the compact.
How can i put the dataset into the datagrid?

Thx in advance.

Marco
 
Read the XML first into DataSet by calling DataSet.ReadXml
and then assing it to the DataSource property of your
DataGrid.
 
I did it, but now im getting a strange error, ill past
that part of the code

System.IO.FileStream myFileStream= new
System.IO.FileStream(@"\\Program
Files\\Clientes.xml",System.IO.FileMode.Open);
dsClientes.ReadXml ("Clientes.xml");

DataTable tblCli = dsClientes.Tables.Add("Clientes");
DataGrid1.DataSource = tblCli;

if anyone could help ill be thankfull.

Cheers
 
I supposed you already have your table "Clientes" in the
DataSet after loading xml, so you instead of:

DataTable tblCli = dsClientes.Tables.Add("Clientes");

Just call:

DataGrid1.DataSource = dsClientes.Tables["Clientes"];

HTH... Alex
 
Back
Top