|
-
January 9th, 2012, 05:06 PM
#2
Re: show data grid view of xml in C# form application
I do the code:
*****************
DataSet ds=new DataSet();
ds.ReadXml("PhoneBookDirectory.xml");
datagridview1.DataSource=ds.Tables(0);
**********
displays:
the name datagridview1 does not exist in the current context
Non-invocable member 'System.Data.DataSet.Tables' cannot be used like a method.
*********************************************
private void butLoad2_Click(object sender, EventArgs e)
{
DataSet myDatadSet=new DataSet();
myDatadSet.ReadXml("PhoneBookDirectory.xml");
dg1.DataSource=ds;
dg1.Bind();
****************
the name dg1 does not exist in the current context
the name ds does not exist in the current context
************************************************************
When I copied the full path of the xml file and put it in the code:
myDatadSet.ReadXml("E:\projects\xml\practice\PhoneBook\PhoneBook\PhoneBookDirectory.xml");
it showed:
Unrecognized escape sequence
********************************
Why is it so?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|