using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Xml; using System.Data.SqlClient; namespace WindowsFormsApplicationtry { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void label1_Click(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { XmlWriter writer = XmlWriter.Create(@"C:\Users\syed\Desktop\SIEM\xml.xml"); writer.WriteStartElement("QUERY"); writer.WriteStartElement("IT"); writer.WriteAttributeString("macName", textBox1.Text); writer.WriteElementString("Generated_source", textBox2.Text); writer.WriteElementString("TimeStemp", textBox3.Text); writer.WriteEndElement(); writer.Close();} private void btnReader_Click_1(object sender, EventArgs e) { string myXMLfile = @"C:\Users\syed\Desktop\SIEM\xml.xml"; DataSet ds = new DataSet(); // Create new FileStream with which to read the schema. System.IO.FileStream fsReadXml = new System.IO.FileStream (myXMLfile, System.IO.FileMode.Open); try { ds.ReadXml(fsReadXml); DataTable dbTable1 = ds.Tables[0]; Gridview.DataSource = dbTable1; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { fsReadXml.Close(); } } private void Form1_Load(object sender, EventArgs e) { // // TODO: This line of code loads data into the 'database1DataSet1.xmlread' table. You can move, or remove it, as needed. // this.xmlreadTableAdapter.Fill(this.database1DataSet1.xmlread); // // TODO: This line of code loads data into the 'dataSet1.Credit' table. You can move, or remove it, as needed. // this.creditTableAdapter.Fill(this.dataSet1.Credit); } private void GridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)