D
deko
This may be an elementary question.
The Build error I get is: "...frmMain.cs(964): The type or namespace name
'xdd' could not be found..."
I create a dataset when frmMain opens:
public frmMain()
{
InitializeComponent();
string xmlSchema = (@"C:\Projects.xsd");
string xmlFile = (@"C:\Projects.xml");
//create XmlDataDocument and load schema
XmlDataDocument xdd = new XmlDataDocument();
xdd.DataSet.ReadXmlSchema(xmlSchema);
// load xml data
XmlTextReader reader = new XmlTextReader(xmlFile);
reader.MoveToContent(); // move reader root node
xdd.Load(reader);
}
I have a button on frmMain that, when clicked, should update the dataset.
private void btnAddCfg_Click(object sender, System.EventArgs e)
{
if (this.txtCfgNam.Text.ToString().Length > 0)
{
DataTable cfg = xdd.DataSet.Tables["Configuration"]; //<<== error
received here **
cfg.Rows[0]["ConfigName"] = "test";
}
}
How do I make the dataset available to all methods in the form? Am I
creating the Dataset in the right place?
Thanks in advance.
The Build error I get is: "...frmMain.cs(964): The type or namespace name
'xdd' could not be found..."
I create a dataset when frmMain opens:
public frmMain()
{
InitializeComponent();
string xmlSchema = (@"C:\Projects.xsd");
string xmlFile = (@"C:\Projects.xml");
//create XmlDataDocument and load schema
XmlDataDocument xdd = new XmlDataDocument();
xdd.DataSet.ReadXmlSchema(xmlSchema);
// load xml data
XmlTextReader reader = new XmlTextReader(xmlFile);
reader.MoveToContent(); // move reader root node
xdd.Load(reader);
}
I have a button on frmMain that, when clicked, should update the dataset.
private void btnAddCfg_Click(object sender, System.EventArgs e)
{
if (this.txtCfgNam.Text.ToString().Length > 0)
{
DataTable cfg = xdd.DataSet.Tables["Configuration"]; //<<== error
received here **
cfg.Rows[0]["ConfigName"] = "test";
}
}
How do I make the dataset available to all methods in the form? Am I
creating the Dataset in the right place?
Thanks in advance.