ReadXml() public method

public ReadXml ( Stream stream ) : XmlReadMode
stream Stream
return XmlReadMode
        protected void Page_Load(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();
            DataSet ds1 = new DataSet();
            ds.ReadXml(@"D:\Books.xml");

            bookgrd.DataSource = ds.Tables[0];
            bookgrd.DataBind();

            IEnumerable<DataRow> tbl1row = ds.Tables[0].AsEnumerable();
            ds1.ReadXml(@"D:\Books2.xml");

            IEnumerable<DataRow> tbl2row = ds1.Tables[0].AsEnumerable();
            GridView1.DataSource = ds1.Tables[0];
            GridView1.DataBind();

            var items = tbl2row.AsEnumerable().Select(r => r.Field<string>("id"))
            .Except(tbl1row.AsEnumerable().Select(r => r.Field<string>("id")));

            DataTable TableC = (from row in tbl2row.AsEnumerable()
                                join id in items
                                on row.Field<string>("id") equals id
                                select row).CopyToDataTable();

            GridView2.DataSource = TableC;
            GridView2.DataBind();
        }
        private void ArrayBinding_Load(object sender, System.EventArgs e)
        {
            // Access database
            System.Windows.Forms.DataVisualization.Charting.Utilities.SampleMain.MainForm mainForm = (System.Windows.Forms.DataVisualization.Charting.Utilities.SampleMain.MainForm)this.ParentForm;

            // The XML document
            string fileNameString = mainForm.applicationPath + "\\data\\data.xml";
            string fileNameSchema = mainForm.applicationPath + "\\data\\data.xsd";

            // Initializes a new instance of the DataSet class
            DataSet custDS = new DataSet();

            // Reads an XML schema into the DataSet.
            custDS.ReadXmlSchema( fileNameSchema );

            // Reads XML schema and data into the DataSet.
            custDS.ReadXml( fileNameString );

            // Initializes a new instance of the DataView class
            DataView firstView = new DataView(custDS.Tables[0]);

            Chart1.Series.Clear();
            // Since the DataView implements and IEnumerable, pass the reader directly into
            // the DataBindTable method with the name of the column used for the X value.
            Chart1.DataBindTable(firstView, "Name");

            // Set series appearance
            Chart1.Series[0].ChartType = SeriesChartType.Bar;
            Chart1.Series[0].Font = new Font("Trebuchet MS", 8);
            Chart1.Series[0].Color = System.Drawing.Color.FromArgb(220, 224,64,10);
            Chart1.Series[0].BorderWidth = 0;
        }
Esempio n. 3
0
        public XmlToCsvUsingDataSet(string xmlSourceFilePath, bool autoRenameWhenNamingConflict)
        {
            XmlDataSet = new DataSet();
            try
            {
                XmlDataSet.ReadXml(xmlSourceFilePath);

                foreach (DataTable table in XmlDataSet.Tables)
                {
                    TableNameCollection.Add(table.TableName);
                }
            }
            catch (DuplicateNameException)
            {
                if (autoRenameWhenNamingConflict)
                {
                    XmlDataSet.ReadXml(xmlSourceFilePath, XmlReadMode.IgnoreSchema);

                    foreach (DataTable table in XmlDataSet.Tables)
                    {
                        TableNameCollection.Add(table.TableName);
                    }

                    RenameDuplicateColumn();
                }
                else
                {
                    throw;
                }
            }
        }
Esempio n. 4
0
        public virtual DataSet Parse(string fileName, Stream stream)
        {
            DataSet ds = new DataSet();

            if (stream != null)
            {
                ds.ReadXml(stream);
            }
            else ds.ReadXml(fileName);

            return ds;
        }
Esempio n. 5
0
        public static DataTable DeserializeTable(string filename)
        {
            DataSet ds = new DataSet();
            ds.Locale = System.Globalization.CultureInfo.InvariantCulture;

            if (File.Exists(GetPath(filename)))
                ds.ReadXml(GetPath(filename));
            else
                ds.ReadXml(GetResource(filename));
            DataTable dt = ds.Tables[0];
            ds.Tables.Remove(dt);
            return dt;
        }
Esempio n. 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(Request.QueryString["dil"]) && !IsPostBack)
        {
            ImgKaydet.Visible = true;
            dil = (new CultureInfo(Convert.ToInt32(Request.QueryString["dil"]))).Name;
            if (Request.QueryString["dil"] != Snlg_ConfigValues.defaultLangId )
                dosyaYolu = Server.MapPath("~/App_GlobalResources/default." + dil + ".resx");
            else
                dosyaYolu = Server.MapPath("~/App_GlobalResources/default.resx");

            DataSet ds = new DataSet();
            DataTable dtOrj = new DataTable();
            DataTable dtLang = new DataTable();
            try
            {
                ds.ReadXml(Server.MapPath("~/App_GlobalResources/default.resx"));
                dtOrj.Merge(ds.Tables["data"]);
                dtOrj.PrimaryKey = new DataColumn[1] { dtOrj.Columns["name"] };
                dtOrj.Columns.Add(new DataColumn("yeniDeger", System.Type.GetType("System.String")));
                if (Request.QueryString["dil"] != Snlg_ConfigValues.defaultLangId )
                {
                    if (File.Exists(dosyaYolu))
                    {
                        ds.Tables.Clear();
                        ds.ReadXml(dosyaYolu);
                        dtLang.Merge(ds.Tables["data"]);
                        foreach (DataRow dr in dtLang.Rows)
                        {
                            try { dtOrj.Rows.Find(dr["name"])["yeniDeger"] = dr["value"]; }
                            catch { }
                        }
                    }
                }
                else
                    foreach (DataRow dr in dtOrj.Rows)
                        dr["yeniDeger"] = dr["value"];

                dtLang = null;
                DataView dv = dtOrj.DefaultView;
                dv.Sort = "name";
                Grid.DataSource = dv;
                Grid.DataBind();
            }
            catch (Exception exc)
            {
                Snlg_Hata.ziyaretci.ExceptionLogla(exc);
            }
        }
    }
Esempio n. 7
0
        internal static void getLocalResource(string filePath, string languageCode, out System.Data.DataSet dataSet)
        {
            dataSet = null;
            string xmlFilePath = string.Empty;

            if (string.IsNullOrEmpty(filePath))
            {
                filePath = System.Web.HttpContext.Current.Request.CurrentExecutionFilePath;
            }
            if (string.IsNullOrEmpty(languageCode))
            {
                languageCode = commonVariables.SelectedLanguage;
            }

            xmlFilePath = System.Web.HttpContext.Current.Server.MapPath(@"~/App_Data/" + languageCode + @"/" + filePath + ".xml");

            if (System.IO.File.Exists(xmlFilePath))
            {
                dataSet = new System.Data.DataSet(); dataSet.ReadXml(xmlFilePath);
            }
            else
            {
                xmlFilePath = System.Web.HttpContext.Current.Server.MapPath(@"~/App_Data/en-us/" + filePath + ".xml");
                if (System.IO.File.Exists(xmlFilePath))
                {
                    dataSet = new System.Data.DataSet(); dataSet.ReadXml(xmlFilePath);
                }
            }
        }
Esempio n. 8
0
        public Dictionary <string, string> getLicDetails(string licFile)
        {
            try
            {
                string path = licFile;// @"License.XML";

                if (File.Exists(path))
                {
                    System.Data.DataSet _ds    = new System.Data.DataSet();
                    XmlDocument         xmlDoc = new XmlDocument();
                    xmlDoc = Helper.Encryption.getXmlData(path);
                    _ds.ReadXml(new XmlTextReader(new System.IO.StringReader(xmlDoc.InnerXml)));
                    guid = _ds.Tables[0].Rows[0]["GUID"].ToString();

                    if (_ds.Tables[0].Rows.Count > 0)
                    {
                        string macAddress = GetMACAddress();
                        // MessageBox.Show(macAddress);
                        licDetailsDict.Add("MAC", _ds.Tables[0].Rows[0]["MacAddress"].ToString().Trim());
                        licDetailsDict.Add("MachineName", _ds.Tables[0].Rows[0]["MachineName"].ToString().Trim());
                        licDetailsDict.Add("Version", _ds.Tables[0].Rows[0]["Version"].ToString().Trim());
                        licDetailsDict.Add("NoOfDays", _ds.Tables[0].Rows[0]["NoOfDays"].ToString().Trim());
                        licDetailsDict.Add("DevCode", _ds.Tables[0].Rows[0]["DevCode"].ToString().Trim());
                        licDetailsDict.Add("GUID", _ds.Tables[0].Rows[0]["GUID"].ToString().Trim());
                    }
                }
            }
            catch (SystemException ex)
            { }

            return(licDetailsDict);
        }
Esempio n. 9
0
        internal static void getRootResource(string fileName, string languageCode, out System.Data.DataTable dataTable)
        {
            dataTable = null;
            string fileDirectory = string.Empty;
            string xmlFilePath   = string.Empty;

            System.Data.DataSet dataSet = null;

            fileDirectory = directory.appPath;

            if (string.IsNullOrEmpty(languageCode))
            {
                languageCode = commonVariables.SelectedLanguage;
            }

            xmlFilePath = fileDirectory + @"App_LocalResources\" + languageCode + @"\" + fileName + ".xml";

            if (System.IO.File.Exists(xmlFilePath))
            {
                using (dataSet = new System.Data.DataSet()) { dataSet.ReadXml(xmlFilePath); dataTable = dataSet.Tables[0]; }
            }
            else
            {
                xmlFilePath = fileDirectory + @"App_LocalResources\en-us\" + fileName + ".xml";
                using (dataSet = new System.Data.DataSet()) { dataSet.ReadXml(xmlFilePath); dataTable = dataSet.Tables[0]; }
            }
        }
Esempio n. 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
		// create the connection, DataAdapter and DataSet
		string connectionString = WebConfigurationManager.ConnectionStrings["Northwind"].ConnectionString;
		string sql = "SELECT TOP 5 EmployeeID, TitleOfCourtesy, LastName, FirstName FROM Employees";
		SqlConnection conn = new SqlConnection(connectionString);
		SqlDataAdapter da = new SqlDataAdapter(sql, conn);
		DataSet ds = new DataSet();

		// Fill the DataSet and fill the first grid.
		da.Fill(ds, "Employees");
		Datagrid1.DataSource = ds.Tables["Employees"];
		Datagrid1.DataBind();

		// Generate the XML file.
		string xmlFile = Server.MapPath("Employees.xml");
		ds.WriteXml(xmlFile, XmlWriteMode.WriteSchema);

		// Load the XML file.
		DataSet dsXml = new DataSet();
		dsXml.ReadXml(xmlFile);
		// Fill the second grid.
		Datagrid2.DataSource = dsXml.Tables["Employees"];
		Datagrid2.DataBind();

    }
Esempio n. 11
0
 /// <summary>
 /// 查找数据。返回一个DataView
 /// </summary>
 /// <param name="XmlPathNode"></param>
 /// <returns></returns>
 public DataView GetData(string _XmlPathNode)
 {
     DataSet _ds = new DataSet();
     StringReader _read = new StringReader(_objXmlDoc.SelectSingleNode(_XmlPathNode).OuterXml);
     _ds.ReadXml(_read);
     return _ds.Tables[0].DefaultView;
 }
Esempio n. 12
0
        protected void InitData()
        {
            string text = base.Request.QueryString["id"];

            System.Data.DataSet dataSet = new System.Data.DataSet();
            string text2 = System.Web.HttpContext.Current.Server.MapPath("/config/WifiConfig.xml");

            if (System.IO.File.Exists(text2))
            {
                dataSet.ReadXml(text2);
                if (dataSet != null)
                {
                    foreach (System.Data.DataRow dataRow in dataSet.Tables[0].Rows)
                    {
                        if (dataRow["id"].ToString() == text)
                        {
                            this.hd_id.Value           = text;
                            this.txt_wifiName.Text     = dataRow["wifiName"].ToString();
                            this.txt_wifiPwd.Text      = dataRow["wifiPwd"].ToString();
                            this.txt_wifiDescribe.Text = dataRow["wifiDescribe"].ToString();
                        }
                    }
                }
            }
        }
Esempio n. 13
0
        public IpProperties GetCountryByIP(string ipAddress)
        {
            string ipResponse = IPRequestHelper("http://ip-api.com/xml/" + ipAddress);

            using (TextReader sr = new StringReader(ipResponse))
            {
                using (System.Data.DataSet dataBase = new System.Data.DataSet())
                {
                    IpProperties ipProperties = new IpProperties();
                    dataBase.ReadXml(sr);
                    ipProperties.Status      = dataBase.Tables[0].Rows[0][0].ToString();
                    ipProperties.Country     = dataBase.Tables[0].Rows[0][1].ToString();
                    ipProperties.CountryCode = dataBase.Tables[0].Rows[0][2].ToString();
                    ipProperties.Region      = dataBase.Tables[0].Rows[0][3].ToString();
                    ipProperties.RegionName  = dataBase.Tables[0].Rows[0][4].ToString();
                    ipProperties.City        = dataBase.Tables[0].Rows[0][5].ToString();
                    ipProperties.Zip         = dataBase.Tables[0].Rows[0][6].ToString();
                    ipProperties.Lat         = dataBase.Tables[0].Rows[0][7].ToString();
                    ipProperties.Lon         = dataBase.Tables[0].Rows[0][8].ToString();
                    ipProperties.TimeZone    = dataBase.Tables[0].Rows[0][9].ToString();
                    ipProperties.ISP         = dataBase.Tables[0].Rows[0][10].ToString();
                    ipProperties.ORG         = dataBase.Tables[0].Rows[0][11].ToString();
                    ipProperties.AS          = dataBase.Tables[0].Rows[0][12].ToString();
                    ipProperties.Query       = dataBase.Tables[0].Rows[0][13].ToString();

                    country = ipProperties.Country;

                    return(ipProperties);
                }
            }
        }
Esempio n. 14
0
        internal static void getLocalResource(string filePath, string languageCode, out System.Data.DataTable dataTable)
        {
            dataTable = null;

            string fileName      = string.Empty;
            string fileDirectory = string.Empty;
            string xmlFilePath   = string.Empty;

            System.Data.DataSet dataSet = null;

            if (string.IsNullOrEmpty(filePath))
            {
                filePath = System.Web.HttpContext.Current.Request.CurrentExecutionFilePath;
            }

            fileName      = System.IO.Path.GetFileName(filePath);
            fileDirectory = System.Web.HttpContext.Current.Server.MapPath(filePath).Replace(fileName, "");

            if (string.IsNullOrEmpty(languageCode))
            {
                languageCode = commonVariables.SelectedLanguage;
            }

            xmlFilePath = fileDirectory + @"App_LocalResources\" + languageCode + @"\" + fileName + ".xml";

            if (System.IO.File.Exists(xmlFilePath))
            {
                using (dataSet = new System.Data.DataSet()) { dataSet.ReadXml(xmlFilePath); dataTable = dataSet.Tables[0]; }
            }
            else
            {
                xmlFilePath = fileDirectory + @"App_LocalResources\en-us\" + fileName + ".xml";
                using (dataSet = new System.Data.DataSet()) { dataSet.ReadXml(xmlFilePath); dataTable = dataSet.Tables[0]; }
            }
        }
Esempio n. 15
0
File: Form1.cs Progetto: 3A9C/ITstep
        public Form1()
        {
            InitializeComponent();

            XmlReader xmlFile1;
            xmlFile1 = XmlReader.Create("../../cd_catalog _1.xml", new XmlReaderSettings());
            DataSet ds1 = new DataSet();
            ds1.ReadXml(xmlFile1);
            dataGridView1.DataSource = ds1.Tables[0];

            XmlReader xmlFile2;
            xmlFile2 = XmlReader.Create("../../cd_catalog _2.xml", new XmlReaderSettings());
            DataSet ds2 = new DataSet();
            ds2.ReadXml(xmlFile2);
            dataGridView2.DataSource = ds2.Tables[0];

            List<string> cd_catalog_1 = dataGridView1.Rows
                       .OfType<DataGridViewRow>()
                       .Where(x => x.Cells[1].Value != null)
                       .Select(x => x.Cells[1].Value.ToString())
                       .ToList();

            List<string> cd_catalog_2 = dataGridView2.Rows
                       .OfType<DataGridViewRow>()
                       .Where(x => x.Cells[1].Value != null)
                       .Select(x => x.Cells[1].Value.ToString())
                       .ToList();
        }
        private void mergeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();
            ds.ReadXml("data.xml");

            mailMerge1.Merge(ds.Tables[0]);
        }
Esempio n. 17
0
        public static string GetTableAlias(string tableName)
        {
            if (__tableNames == null)
            {
                DataSet _data = new DataSet();
                _data.ReadXml(System.Configuration.ConfigurationManager.AppSettings["PathXMLAlias"]);

                __tableNames = new System.Collections.Hashtable();
                foreach (DataRow row in _data.Tables[0].Rows)
                {
                    if (!__tableNames.ContainsKey(row["name"].ToString().ToLower().Trim()))
                    {
                        __tableNames.Add(row["name"].ToString().ToLower().Trim(), row["alias"].ToString());
                    }
                }
            }


            if (__tableNames.ContainsKey(tableName))
            {
                return __tableNames[tableName].ToString();
            }

            return tableName;
        }
Esempio n. 18
0
 public static DataTable GetProducts()
 {
     DataSet dsStore = new DataSet();
     dsStore.ReadXmlSchema(Application.StartupPath + "\\store.xsd");
     dsStore.ReadXml(Application.StartupPath + "\\store.xml");
     return dsStore.Tables["Products"];
 }
Esempio n. 19
0
        private void Inventory1_Load(object sender, EventArgs e)
        {
            lblItemCode.Text = CERPInventory.ItemCode;
            lblItemDesc.Text = CERPInventory.ItemDesc;

            CERPWS.Service1 svc = new CERPWS.Service1();
            string result = svc.GetWarehouseInventory(CERPInventory.ItemID);

            StringReader sr = new StringReader(result);
            DataSet ds = new DataSet();
            DataTable dt = new DataTable("table");
            ds.ReadXml(sr);
            dt = ds.Tables[0];
            if (dt.Rows[0].ItemArray[0].ToString() == "0")
            {
                MessageBox.Show(dt.Rows[0].ItemArray[1].ToString());
                CERPInventory.Qty = 0;
                lblQty.Text = CERPInventory.Qty.ToString();
                lblUOM.Text = "";

                CERPInventory.OutOfStock = true;
            }
            else
            {
                CERPInventory.Qty = Convert.ToDecimal(dt.Rows[0].ItemArray[0].ToString());
                CERPInventory.UOM = dt.Rows[0].ItemArray[1].ToString();
                lblQty.Text = CERPInventory.Qty.ToString("G29");
                lblUOM.Text = CERPInventory.UOM;

                CERPInventory.OutOfStock = false;
            }
        }
Esempio n. 20
0
        /// <summary>  
        /// WebService para Busca de CEP  
        ///  </summary>  
        /// <param  name="CEP"></param>  
        public CEP(string CEP)
        {
            _uf = "";
            _cidade = "";
            _bairro = "";
            _tipo_lagradouro = "";
            _lagradouro = "";
            _resultado = "0";
            _resultato_txt = "CEP não encontrado";

            //Cria um DataSet  baseado no retorno do XML
            DataSet ds = new DataSet();
            ds.ReadXml("http://cep.republicavirtual.com.br/web_cep.php?cep=" + CEP.Replace("-", "").Trim() + "&formato=xml");

            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    _resultado = ds.Tables[0].Rows[0]["resultado"].ToString();
                    switch (_resultado)
                    {
                        case "1":
                            _uf = ds.Tables[0].Rows[0]["uf"].ToString().Trim();
                            _cidade = ds.Tables[0].Rows[0]["cidade"].ToString().Trim();
                            _bairro = ds.Tables[0].Rows[0]["bairro"].ToString().Trim();
                            _tipo_lagradouro = ds.Tables[0].Rows[0]["tipo_logradouro"].ToString().Trim();
                            _lagradouro = ds.Tables[0].Rows[0]["logradouro"].ToString().Trim();
                            _resultato_txt = "CEP completo";
                            break;
                        case "2":
                            _uf = ds.Tables[0].Rows[0]["uf"].ToString().Trim();
                            _cidade = ds.Tables[0].Rows[0]["cidade"].ToString().Trim();
                            _bairro = "";
                            _tipo_lagradouro = "";
                            _lagradouro = "";
                            _resultato_txt = "CEP  único";
                            break;
                        default:
                            _uf = "";
                            _cidade = "";
                            _bairro = "";
                            _tipo_lagradouro = "";
                            _lagradouro = "";
                            _resultato_txt = "CEP não  encontrado";
                            break;
                    }
                }
            }
            //Exemplo do retorno da  WEB
            //<?xml version="1.0"  encoding="iso-8859-1"?>
            //<webservicecep>
            //<uf>RS</uf>
            //<cidade>Porto  Alegre</cidade>
            //<bairro>Passo  D'Areia</bairro>
            //<tipo_logradouro>Avenida</tipo_logradouro>
            //<logradouro>Assis Brasil</logradouro>
            //<resultado>1</resultado>
            //<resultado_txt>sucesso - cep  completo</resultado_txt>
            //</webservicecep>
        }
Esempio n. 21
0
        public void ThrowException()
        {
            DataSet result = new DataSet();
            XmlReader xRead = XmlReader.Create(new StringReader(new backoffice.proxy().request("", "")));

            result.ReadXml(xRead);
        }
        /// <summary>
        /// Reads the list of recognized keyboards
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static DataSet readKeyboardList(string path)
        {
            string ProfilePathFilename = path + @"\ValidKeyboards.xml";
            DataTable dtValidKeyboards;

            // Create the Profile data set.
            DataSet dsValidKeyboards = new DataSet();

            dtValidKeyboards = new DataTable("Keyboard");

            dtValidKeyboards.Columns.Add(new DataColumn("DeviceName", typeof(string)));

            dsValidKeyboards.Tables.Add(dtValidKeyboards);

            // Clear out the Profile data table.
            dtValidKeyboards.Rows.Clear();

            // Check to see if the Profile already exists in storage, load and return true.
            // If it does not exist, only return false.
            if (File.Exists(ProfilePathFilename))
            {
                dsValidKeyboards.ReadXml(ProfilePathFilename, XmlReadMode.ReadSchema);
            }
            else
            {
                // maybe do something here
            }
            // Return the file loaded status.  Default is false / bad load.
            return dsValidKeyboards;
        }
Esempio n. 23
0
        public ActionResult Feedback()
        {
            List <ContactModel> list = new List <ContactModel>();

            if (System.IO.File.Exists(Server.MapPath(@"~/feedback.xml")))
            {
                DataSet dSet = new System.Data.DataSet();
                dSet.ReadXml(Server.MapPath(@"~/feedback.xml"));

                DataTable comments = dSet.Tables["customer_comment"];
                foreach (DataRow row in comments.Rows)
                {
                    ContactModel model = new ContactModel();
                    model.Name       = row["name"].ToString();
                    model.Email      = row["email"].ToString();
                    model.BookingRef = row["bookingRef"].ToString();
                    model.Topic      = row["topic"].ToString();
                    model.Comments   = row["comments"].ToString();
                    model.Stay       = row["stayAgain"].ToString();
                    model.Recommend  = row["recommend"].ToString();
                    //string istring = row["date"].ToString();
                    //model.Time = DateTime.ParseExact(istring, "dd-mmM-yyyy HH:mm:ss tt", null);
                    //model.Time = DateTime.ParseExact(istring, "D", null);

                    list.Add(model);
                }
            }
            return(View(list));
        }
Esempio n. 24
0
        public XmlDataAdapter(String dbname)
        {
			_savePath = Environment.CurrentDirectory;
            _savePath = Path.Combine(_savePath,dbname + ".xml");
            if(Directory.Exists(Path.GetDirectoryName(_savePath)) == false)
                Directory.CreateDirectory(Path.GetDirectoryName(_savePath));
            if (File.Exists(_savePath))
            {
                _dataset = new DataSet();
                try
                {
                    _dataset.ReadXml(_savePath, XmlReadMode.Auto);
                }
                catch(Exception e)
                {
                    File.Move(_savePath, String.Format("{0}.corrupted",_savePath));
                    _dataset = new DataSet(dbname);
                    _dataset.WriteXml(_savePath, XmlWriteMode.WriteSchema);
                }
            }
            else
            {
                _dataset = new DataSet(dbname);
                _dataset.WriteXml(_savePath, XmlWriteMode.WriteSchema);
            }
        }
Esempio n. 25
0
 /// <summary>
 /// 读取指定节点的值
 /// </summary>
 /// <param name="XmlPathNode">节点的XPATH</param>
 /// <returns>返回一个DataView</returns>
 public DataSet GetData(string XmlPathNode)
 {
     DataSet ds = new DataSet();
     StringReader read = new StringReader(objXmlDoc.SelectSingleNode(XmlPathNode).OuterXml);
     ds.ReadXml(read);
     return ds;
 }
Esempio n. 26
0
        public static void ReadXMLToRestoreDatabase()
        {
            foreach (var tblName in tableNames.Reverse())
            {
                String tblFileName = tblName + ".xml";
                if (File.Exists(PATH + tblFileName))
                {
                    using (var filestream = File.Open(PATH + tblFileName, FileMode.Open))
                    {
                        System.Data.DataSet ds = new System.Data.DataSet(tblName);
                        using (SqlConnection con = (SqlConnection)database.CreateOpenConnection())
                        {
                            database.CreateStoredProcCommand("EnableIDInsert", con).ExecuteNonQuery();
                            var adapter = SetUPAdapterForTable((SqlConnection)con, tblName);
                            adapter.TableMappings.Add(tblName, tblName);
                            //adapter.Fill(dataSet);
                            ds.ReadXml(filestream);
                            if (ds.Tables.Count > 0)
                            {
                                using (SqlBulkCopy cop = new SqlBulkCopy(con, SqlBulkCopyOptions.KeepIdentity, null))
                                {
                                    cop.DestinationTableName = "dbo." + tblName;
                                    cop.WriteToServer(ds.Tables[0]);
                                }
                            }

                            database.CreateStoredProcCommand("DisableIDInsert", con).ExecuteNonQuery();
                        }
                    }
                }
            }
        }
Esempio n. 27
0
        public static void ReadRoutesFromXML(String fileName)
        {
            if (File.Exists(PATH + fileName))
            {
                using (var filestream = File.Open(PATH + fileName, FileMode.Open))
                {
                    System.Data.DataSet ds = new System.Data.DataSet("tblRuta");
                    using (SqlConnection con = (SqlConnection)database.CreateOpenConnection())
                    {
                        database.CreateStoredProcCommand("emptyDB", con).ExecuteNonQuery();

                        database.CreateStoredProcCommand("EnableIDInsert", con).ExecuteNonQuery();
                        var adapter = SetUPAdapterForTable((SqlConnection)con, "tblRuta");
                        adapter.TableMappings.Add("tblRuta", "tblRuta");
                        //adapter.Fill(dataSet);
                        ds.ReadXml(filestream);
                        if (ds.Tables.Count > 0)
                        {
                            using (SqlBulkCopy cop = new SqlBulkCopy(con, SqlBulkCopyOptions.KeepIdentity, null))
                            {
                                cop.DestinationTableName = "dbo." + "tblRuta";
                                cop.WriteToServer(ds.Tables[0]);
                            }
                        }

                        database.CreateStoredProcCommand("DisableIDInsert", con).ExecuteNonQuery();
                    }
                }
            }
        }
        private void GetDetailInfo()
        {
            #region
            //调用台站详细信息服务
            PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA_StationManage>(channel =>
            {
                string strStation = channel.SearchStationByGuid(m_statGuid);
                if (!string.IsNullOrEmpty(strStation))
                {
                    System.IO.StringReader xmlSR      = new System.IO.StringReader(strStation);
                    System.Data.DataSet CurrentResult = new System.Data.DataSet();
                    MemoryStream ms = new MemoryStream(Convert.FromBase64String(strStation));
                    CurrentResult.ReadXml(ms, XmlReadMode.Auto);


                    //StringReader xmlSR = new StringReader(strStationStr);
                    //CurrentResult.ReadXml(xmlSR, XmlReadMode.Auto); //忽视任何内联架构,从数据推断出强类型架构并加载数据。如果无法推断,则解释成字符串数据
                    if (CurrentResult.Tables.Count > 0)
                    {
                        ShowDetail(CurrentResult);
                    }
                    else
                    {
                        MessageBox.Show("获取不到台站概要信息,请确认数据源是否改变!");
                    }
                }
                else
                {
                    MessageBox.Show("获取不到台站概要信息,请确认数据源是否改变!");
                }
            });
            #endregion
        }
Esempio n. 29
0
 private void Bind(string strTypeID,string strTypeName="")
 {
     DataSet ds = new DataSet();
     ds.ReadXml(Server.MapPath("~/FileManager/File.xml"));
     DataRow[] drs = null;
     if (strTypeID != "")
     {
          drs = ds.Tables[0].Select("ParentID='" + strTypeID + "'");
     }
     else
     {
         drs = ds.Tables[0].Select("ParentID='0'");
     }
     DataTable dt = ds.Tables[0].Clone();
     foreach (DataRow dr in drs)
     {
         dt.Rows.Add(dr.ItemArray);
     }
     dt.AcceptChanges();
     this.dgDocView.DataSource = dt;
     this.dgDocView.DataBind();
     ViewState["TypeID"] = strTypeID;
     ViewState["TypeName"] = strTypeName;
     lbTypeName.Text = strTypeName;
 }
Esempio n. 30
0
        public Form1()
        {
            // How to Activate
            //Stimulsoft.Base.StiLicense.Key = "6vJhGtLLLz2GNviWmUTrhSqnO...";
            //Stimulsoft.Base.StiLicense.LoadFromFile("license.key");
            //Stimulsoft.Base.StiLicense.LoadFromStream(stream);

            InitializeComponent();

            if (File.Exists("..\\Data\\Demo.xsd"))
            {
                dataSet1.ReadXmlSchema("..\\Data\\Demo.xsd");
            }
            else
            {
                MessageBox.Show("File \"Demo.xsd\" not found");
            }

            if (File.Exists("..\\Data\\Demo.xsd"))
            {
                dataSet1.ReadXml("..\\Data\\Demo.xml");
            }
            else
            {
                MessageBox.Show("File \"Demo.xml\" not found");
            }

            dataSet1.DataSetName = "Demo";
        }
Esempio n. 31
0
        public void helloWorldTest()
        {
            DataSet helloworld = new DataSet();
            helloworld.ReadXml(ConfigurationSettings.AppSettings["XmlPath"].ToString());
            sceenshotpath=helloworld.Tables[0].Rows[0].ItemArray[10].ToString();
            baseUrl = helloworld.Tables[1].Rows[0].ItemArray[1].ToString() + ":" + "//" + helloworld.Tables[1].Rows[0].ItemArray[2].ToString() + ":" + helloworld.Tables[1].Rows[0].ItemArray[3].ToString() + "/" + helloworld.Tables[1].Rows[0].ItemArray[0].ToString();
            Directory.CreateDirectory(helloworld.Tables[0].Rows[0].ItemArray[9].ToString());
           try
            {
               //Opens Phresco Home Page.   
               driver.Navigate().GoToUrl(baseUrl);
               //Click on site actions and go to edit page.
               driver.FindElement(By.XPath(helloworld.Tables[0].Rows[0].ItemArray[4].ToString())).Click();
               driver.FindElement(By.XPath(helloworld.Tables[0].Rows[0].ItemArray[5].ToString())).Click();
               Thread.Sleep(Convert.ToInt32(helloworld.Tables[0].Rows[0].ItemArray[3].ToString()));
               //Close the hello world web part.
               driver.FindElement(By.XPath(helloworld.Tables[0].Rows[0].ItemArray[6].ToString())).Click();
               Thread.Sleep(Convert.ToInt32(helloworld.Tables[0].Rows[0].ItemArray[3].ToString()));                        
               driver.Navigate().Refresh();
               driver.Navigate().GoToUrl(baseUrl);
                            
               }
            catch (Exception e)
            {

                TakeScreenshot(driver, helloworld.Tables[0].Rows[0].ItemArray[10].ToString());
                throw e;
                
            }
        }
Esempio n. 32
0
        public static void CreateMenuJson()
        {
            string jsPath = Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "admin/xml/navmenu.js");

            System.Data.DataSet dsSrc = new System.Data.DataSet();
            dsSrc.ReadXml(configPath);
            StringBuilder menustr = new StringBuilder();

            menustr.Append("var toptabmenu = ");
            menustr.Append(Utils.DataTableToJSON(dsSrc.Tables[2]));
            menustr.Append("\r\nvar mainmenu = ");
            menustr.Append(Utils.DataTableToJSON(dsSrc.Tables[0]));
            menustr.Append("\r\nvar submenu = ");
            menustr.Append(Utils.DataTableToJSON(dsSrc.Tables[1]));
            menustr.Append("\r\nvar shortcut = ");
            if (dsSrc.Tables.Count < 4)
            {
                menustr.Append("[]");
            }
            else
            {
                menustr.Append(Utils.DataTableToJSON(dsSrc.Tables[3]));
            }
            WriteJsonFile(jsPath, menustr);
            dsSrc.Dispose();
        }
Esempio n. 33
0
        internal static void getLocalResource(out System.Data.DataSet dataSet)
        {
            dataSet = null;

            string filePath      = string.Empty;
            string fileDirectory = string.Empty;
            string filename      = string.Empty;
            string languageCode  = string.Empty;
            string xmlFilePath   = string.Empty;

            filePath      = System.Web.HttpContext.Current.Request.CurrentExecutionFilePath;
            filename      = System.IO.Path.GetFileName(filePath);
            fileDirectory = System.Web.HttpContext.Current.Server.MapPath(filePath).Replace(filename, "");

            languageCode = commonVariables.SelectedLanguage;

            xmlFilePath = fileDirectory + @"App_LocalResources\" + languageCode + @"\" + filename + ".xml";

            if (System.IO.File.Exists(xmlFilePath))
            {
                dataSet = new System.Data.DataSet();
                dataSet.ReadXml(xmlFilePath);
            }
            else
            {
                xmlFilePath = fileDirectory + @"App_LocalResources\en-us\" + filename + ".xml";
                dataSet     = new System.Data.DataSet();
                dataSet.ReadXml(xmlFilePath);
            }
        }
Esempio n. 34
0
 protected override void ReadXmlSerializable(System.Xml.XmlReader reader)
 {
     if ((this.DetermineSchemaSerializationMode(reader) == System.Data.SchemaSerializationMode.IncludeSchema))
     {
         this.Reset();
         System.Data.DataSet ds = new System.Data.DataSet();
         ds.ReadXml(reader);
         if ((ds.Tables["VoiceNote"] != null))
         {
             base.Tables.Add(new VoiceNoteDataTable(ds.Tables["VoiceNote"]));
         }
         this.DataSetName        = ds.DataSetName;
         this.Prefix             = ds.Prefix;
         this.Namespace          = ds.Namespace;
         this.Locale             = ds.Locale;
         this.CaseSensitive      = ds.CaseSensitive;
         this.EnforceConstraints = ds.EnforceConstraints;
         this.Merge(ds, false, System.Data.MissingSchemaAction.Add);
         this.InitVars();
     }
     else
     {
         this.ReadXml(reader);
         this.InitVars();
     }
 }
Esempio n. 35
0
        private void FormParameter_Load(object sender, EventArgs e)
        {
            object[] oTemp = new object[3];

            if (strConn != "")
            {
                sqlConn.ConnectionString = strConn;
                sqlComm.Connection       = sqlConn;
                sqlDA.SelectCommand      = sqlComm;
            }
            else
            {
                if (File.Exists(dFileName)) //存在文件
                {
                    dSet.ReadXml(dFileName);

                    numericUpDownWeek.Value = int.Parse(dSet.Tables["parameters"].Rows[0][0].ToString());
                    numericUpDownPass.Value = int.Parse(dSet.Tables["parameters"].Rows[0][1].ToString());
                    numericUpDownTAC.Value  = int.Parse(dSet.Tables["parameters"].Rows[0][2].ToString());
                }
                else //没有文件,建立datatable
                {
                    dSet.Tables.Add("parameters");
                    dSet.Tables["parameters"].Columns.Add("Weeks", System.Type.GetType("System.Decimal"));
                    dSet.Tables["parameters"].Columns.Add("Pass", System.Type.GetType("System.Decimal"));
                    dSet.Tables["parameters"].Columns.Add("TAC", System.Type.GetType("System.Decimal"));

                    oTemp[0] = numericUpDownWeek.Value;
                    oTemp[1] = numericUpDownPass.Value;
                    oTemp[2] = numericUpDownTAC.Value;

                    dSet.Tables["parameters"].Rows.Add(oTemp);
                }
            }
        }
Esempio n. 36
0
        /// <summary>
        /// Запись параметра в файл настроек
        /// </summary>
        /// <param name="KeyName">Имя параметра</param>
        /// <param name="KeyValue">Значение параметра</param>
        /// <returns></returns>
        public bool SetSetting(string KeyName, string KeyValue)
        {
            try
            {
                KeyValue = Encrypt(KeyValue);
                LoadXml();

                System.Data.DataSet ds = new System.Data.DataSet();
                ds.ReadXml(_settingsXML);
                if (ds.Tables.Count == 0 || ds.Tables["SettingString"].Select("KeyName='" + KeyName + "'").Length == 0)
                {
                    // Добавление параметра в файл, если его не существует
                    AddSettingToXml(KeyName, KeyValue);
                }
                else
                {
                    // Редактировать параметр в файле
                    SettingsXmlDoc.SelectSingleNode("//root/SettingString[@KeyName='" + KeyName + "']").Attributes["KeyValue"].Value = KeyValue;
                    SettingsXmlDoc.Save(_settingsXML);
                }
            }
            catch (Exception)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 37
0
	    /// <summary>
		/// 获得模板变量列表
		/// </summary>
		/// <param name="forumpath">模板路径</param>
		/// <param name="skinName">皮肤名</param>
		/// <returns></returns>
		public static DataTable GetTemplateVarList(string forumpath,string skinName)
		{
			Discuz.Cache.DNTCache cache = Cache.DNTCache.GetCacheService();
            DataTable dt = cache.RetrieveSingleObject("/Forum/" + skinName + "/TemplateVariable") as DataTable;            

			if(dt == null)
			{
                DataSet dsSrc = new DataSet("template");

                string[] filename = { Utils.GetMapPath(forumpath + "templates/" + skinName + "/templatevariable.xml") };

                if (Utils.FileExists(filename[0]))
                {
                    dsSrc.ReadXml(filename[0]);
                    if (dsSrc.Tables.Count == 0)
                        dsSrc.Tables.Add(TemplateVariableTable());
                }
                else
                {
                    dsSrc.Tables.Add(TemplateVariableTable());
                }
                dt = dsSrc.Tables[0];
                cache.AddSingleObject("/Forum/" + skinName + "/TemplateVariable", dt, filename);
			}
            return dt;
		}
Esempio n. 38
0
        private void formTZ_Load(object sender, EventArgs e)
        {
            string dFileName1 = Directory.GetCurrentDirectory() + "\\addcon.xml";

            if (File.Exists(dFileName1)) //存在文件
            {
                dSet1.ReadXml(dFileName1);
                comboBoxCOM.SelectedIndex = Int32.Parse(dSet1.Tables["附加信息"].Rows[0][1].ToString());
            }
            else
            {
                comboBoxCOM.SelectedIndex = 0;
            }

            //fc = (formConference)this.ParentForm;
            textBoxTZ.Text = "请您于" + fc.dateTimePickerStart.Value.ToLongDateString() + " " + fc.dateTimePickerStart.Value.ToShortTimeString() + " 参加 " + fc.textBoxCname.Text.Trim();
            if (fc.textBoxCname2.Text.Trim() != "")
            {
                textBoxTZ.Text += "(" + fc.textBoxCname2.Text.Trim() + ")";
            }
            if (fc.textBoxConferenceNo.Text.Trim() != "")
            {
                textBoxTZ.Text += " 会场:" + fc.textBoxConferenceNo.Text.Trim();
            }

            textBoxTZ.Text += " ,请准时到会。";

            toolStripStatusLabelCount.Text = "0/" + fc.intCount.ToString();
        }
Esempio n. 39
0
 protected void Page_Load(object sender, EventArgs e)
 {
     DataSet ds = new DataSet();
     ds.ReadXml(Server.MapPath("~/App_Data/Players.xml"));
     ds.Tables[0].DefaultView.RowFilter = "[Nationality]='United States'";
     GridExtender1.Data.DataSource = ds.Tables[0].DefaultView;
 }
Esempio n. 40
0
        private void formSoftSign_Load(object sender, EventArgs e)
        {
            string strData = "";

            strData = lockit.getMacAddress();
            if (strData == "")
            {
                strData = lockit.getDiskSerial();
            }
            if (strData == "")
            {
                strData = "CHRISTIE(CHENYI)";
            }

            textBoxSerial.Text = lockit.getLockEnData(strData, strpassword);

            if (File.Exists(dFileName)) //´æÔÚÎļþ
            {
                dSet.ReadXml(dFileName);
            }
            else  //½¨Á¢Îļþ
            {
                dSet.Tables.Add("Èí¼þ×¢²á");

                dSet.Tables["Èí¼þ×¢²á"].Columns.Add("×¢²áÂë", System.Type.GetType("System.String"));
                string[] strDRow = { "" };
                dSet.Tables["Èí¼þ×¢²á"].Rows.Add(strDRow);
            }

            textBoxSign.Text = dSet.Tables["Èí¼þ×¢²á"].Rows[0][0].ToString();
        }
Esempio n. 41
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //Create a DataSet from the XML file
            string filePath = "..\\..\\Employees.xml";
            DataSet ds = new DataSet();
            ds.ReadXml(filePath);

            //Create and add barcode column
            DataColumn dc = new DataColumn("BarcodeImage", typeof(byte[]));
            ds.Tables[0].Columns.Add(dc);

            //We'll use Code 128 Barcode Symbology
            BaseBarcode b = BarcodeFactory.GetBarcode(Symbology.Code128);

            b.Height = 50;
            b.FontHeight = 0.3F;
            //Now, generate and fill barcode images
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                //We'll encode the ID column
                b.Number = (string)dr["ID"];

                //Create bitmap and save it to BarcodeImage column
                MemoryStream ms = new MemoryStream();
                b.Save(ms, ImageType.Png);
                dr["BarcodeImage"] = ms.GetBuffer();
            }

            CrystalReport1 report = new CrystalReport1();
            report.SetDataSource(ds);
            crystalReportViewer1.ReportSource = report;
        }
 //将xml文件转换为DataSet
 public static DataSet ConvertXMLFileToDataSet(string xmlFile)
 {
     StringReader stream = null;
     XmlTextReader reader = null;
     try
     {
         XmlDocument xmld = new XmlDocument();
         xmld.Load(xmlFile);
         DataSet xmlDS = new DataSet();
         stream = new StringReader(xmld.InnerXml);
         //从stream装载到XmlTextReader
         reader = new XmlTextReader(stream);
         xmlDS.ReadXml(reader);
         //xmlDS.ReadXml(xmlFile);
         return xmlDS;
     }
     catch (System.Exception ex)
     {
         throw ex;
         //MessageBox.Show(ex.ToString());
     }
     //finally
     //{
     //    if (reader != null) reader.Close();
     //}
 }
Esempio n. 43
0
 public static Boolean verificaCEP(String CEP)
 {
     bool flag = false;
     try
     {
         DataSet ds = new DataSet();
         string xml = "http://cep.republicavirtual.com.br/web_cep.php?cep=@cep&formato=xml".Replace("@cep", CEP);
         ds.ReadXml(xml);
         endereco = ds.Tables[0].Rows[0]["logradouro"].ToString();
         bairro = ds.Tables[0].Rows[0]["bairro"].ToString();
         cidade = ds.Tables[0].Rows[0]["cidade"].ToString();
         estado = ds.Tables[0].Rows[0]["uf"].ToString();
         cep = CEP;
         flag = true;
     }
     catch (Exception ex)
     {
         endereco = "";
         bairro = "";
         cidade = "";
         estado = "";
         cep = "";
     }
     return flag;
 }
Esempio n. 44
0
        private static DataSet GetDataFromService(string url)
        {
            var dataSet = new System.Data.DataSet();

            dataSet.ReadXml(url);
            return(dataSet);
        }
        /// <summary>
        /// Reads the relevant Rss feed and returns a list off RssFeedItems
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static List<RssFeedItem> ReadFeed(string url)
        {
            //create a new list of the rss feed items to return
            List<RssFeedItem> rssFeedItems = new List<RssFeedItem>();

            //create an http request which will be used to retrieve the rss feed
            HttpWebRequest rssFeed = (HttpWebRequest)WebRequest.Create(url);

            //use a dataset to retrieve the rss feed
            using (DataSet rssData = new DataSet())
            {
                //read the xml from the stream of the web request
                rssData.ReadXml(rssFeed.GetResponse().GetResponseStream());

                //loop through the rss items in the dataset and populate the list of rss feed items
                foreach (DataRow dataRow in rssData.Tables["item"].Rows)
                {
                    rssFeedItems.Add(new RssFeedItem
                    {
                        ChannelId = Convert.ToInt32(dataRow["channel_Id"]),
                        Description = Convert.ToString(dataRow["description"]),
                        ItemId = Convert.ToInt32(dataRow["item_Id"]),
                        Link = Convert.ToString(dataRow["link"]),
                        PublishDate = Convert.ToDateTime(dataRow["pubDate"]),
                        Title = Convert.ToString(dataRow["title"])
                    });
                }
            }

            //return the rss feed items
            return rssFeedItems;
        }
Esempio n. 46
0
        public static void CreateMenuJson()
        {
            string jsPath = AppDomain.CurrentDomain.BaseDirectory + "/admin/xml/navmenu.js";

            System.Data.DataSet dsSrc = new System.Data.DataSet();
            dsSrc.ReadXml(configPath);
            StringBuilder menustr = new StringBuilder();

            menustr.Append("var toptabmenu = ");
            menustr.Append(Utils.DataTableToJSON(dsSrc.Tables[2]));
            menustr.Append("\r\nvar mainmenu = ");
            menustr.Append(Utils.DataTableToJSON(dsSrc.Tables[0]));
            menustr.Append("\r\nvar submenu = ");
            menustr.Append(Utils.DataTableToJSON(dsSrc.Tables[1]));
            menustr.Append("\r\nvar shortcut = ");
            if (dsSrc.Tables.Count < 4)
            {
                menustr.Append("[]");
            }
            else
            {
                menustr.Append(Utils.DataTableToJSON(dsSrc.Tables[3]));
            }
            WriteJsonFile(jsPath, menustr);
            dsSrc.Dispose();
        }
Esempio n. 47
0
        private void BindDir(string strTypeID)
        {
            DataSet ds = new DataSet();
            ds.ReadXml(Server.MapPath("~/SystemManager/Document.xml"));
            DataTable dt = ds.Tables[0].Clone();
            DataRow[] drs = null;
            drs = ds.Tables[0].Select("ParentID='" + strTypeID + "'");

            drpDir.Items.Clear();
            drpDir.Items.Add(new ListItem("/", ViewState["TypeID"].ToString()));
            if (drs.Length > 0)
            {
                foreach (DataRow dr in drs)
                {
                    //dt.Rows.Add(dr.ItemArray);

                    ListItem item = new ListItem("/" + dr["TypeName"].ToString(), dr["TypeID"].ToString());
                    drpDir.Items.Add(item);
                }
            }

            drpDir.SelectedValue = "0";
            //dt.AcceptChanges();

            //drpDir.DataSource = dt;
            //drpDir.DataTextField = "TypeName";
            //drpDir.DataValueField="TypeID";
            //drpDir.DataBind();
        }
        /// <summary>
        /// 从 XML 文件中读取数据,形成 DataTable.
        /// 
        /// 参考 A0210_DataSetXML 项目的 DataSetReadXml.cs
        /// </summary>
        /// <returns></returns>
        private static DataSet LoadDataSet()
        {
            // 桔子 DataTable
            DataTable orangeDt = new DataTable("桔子");
            orangeDt.Columns.Add("产地");
            orangeDt.Columns.Add("颜色");
            orangeDt.Columns.Add("味道");
            orangeDt.Columns.Add("品质");

            // 苹果 DataTable
            DataTable appleDt = new DataTable("苹果");
            appleDt.Columns.Add("产地");
            appleDt.Columns.Add("颜色");
            appleDt.Columns.Add("味道");
            appleDt.Columns.Add("品质");

            // 用于返回的 DataSet.
            DataSet ds = new DataSet();

            ds.Tables.Add(orangeDt);
            ds.Tables.Add(appleDt);

            // 读取文件.
            ds.ReadXml("xmlSample.xml");

            // 返回.
            return ds;
        }
        private void UpdateFiltter()
        {
            try
            {
                string filu = @fileUrl;
                DataSet ds = new DataSet();
                DataTable dt = new DataTable();
                DataView dv = new DataView();
                ds.ReadXml(filu);
                dt = ds.Tables[0];

                dv = dt.DefaultView;
                if (cbFiltter.SelectedIndex != -1 && cbFiltter.SelectedIndex != 0)
                {
                    dt.DefaultView.RowFilter = "maa = '" + cbFiltter.SelectedItem.ToString() + "'";
                }

                dgWines.ItemsSource = dv;

            }
            catch (Exception ex)
            {
                throw;
            }
        }
Esempio n. 50
0
        public static int[] LoadFormLocationAndSize(Form xForm)
        {
            int[] t = { 0, 0, 300, 300 };
            if (!File.Exists(Application.StartupPath + Path.DirectorySeparatorChar + "formornetclose.xml"))
                return t;
            DataSet dset = new DataSet();
            dset.ReadXml(Application.StartupPath + Path.DirectorySeparatorChar + "formornetclose.xml");
            int[] LocationAndSize = new int[] { xForm.Location.X, xForm.Location.Y, xForm.Size.Width, xForm.Size.Height };
            //---//
            try
            {

                var AbbA = dset.Tables[0].Rows[0]["Input"].ToString().Split(';');
                //---//
                LocationAndSize[0] = Convert.ToInt32(AbbA[0]);
                LocationAndSize[1] = Convert.ToInt32(AbbA[1]);
                LocationAndSize[2] = Convert.ToInt32(AbbA[2]);
                LocationAndSize[3] = Convert.ToInt32(AbbA[3]);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            //---//
            return LocationAndSize;
        }
        public static object GetEmployeeData()
        {
            string path = DemoUtils.GetRelativePath("TOC_Employees.xml");

            System.Data.DataSet EmployeeDataDS = new System.Data.DataSet();
            EmployeeDataDS.ReadXml(path);
            return(EmployeeDataDS.Tables[1]);
        }
Esempio n. 52
0
    public static void captureData()
    {
        lock (MainClass.data)
        {
            try
            {
                System.Data.DataSet ds = null;
                bool create            = false;
                if (!System.IO.File.Exists(MainClass.location + "bd.xml"))
                {
                    System.Data.DataTable dt = new System.Data.DataTable("Balances");
                    dt.Columns.Add("Date");
                    dt.Columns.Add("Coin");
                    dt.Columns.Add("Amount");

                    dt.Rows.Add("", "", "");

                    System.Data.DataTable dtParameters = new System.Data.DataTable("Parameters");
                    dtParameters.Columns.Add("Parameter");
                    dtParameters.Columns.Add("Value");
                    dtParameters.Rows.Add("", "");


                    ds             = new System.Data.DataSet();
                    ds.DataSetName = "Database";
                    ds.Tables.Add(dt);
                    ds.Tables.Add(dtParameters);
                    ds.WriteXml(MainClass.location + "bd.xml");
                    create = true;
                }

                ds = new System.Data.DataSet();
                ds.ReadXml(MainClass.location + "bd.xml");

                BitMEX.BitMEXApi bitMEXApi  = new BitMEX.BitMEXApi(MainClass.bitmexKeyWeb, MainClass.bitmexSecretWeb, MainClass.bitmexDomain);
                string           json       = bitMEXApi.GetWallet();
                JContainer       jCointaner = (JContainer)JsonConvert.DeserializeObject(json, (typeof(JContainer)));

                if (create)
                {
                    ds.Tables[0].Rows.Clear();
                }

                ds.Tables[0].Rows.Add(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), MainClass.pair, jCointaner[0]["walletBalance"].ToString());

                ds.Tables[1].Rows.Clear();
                ds.Tables[1].Rows.Add("OpenOrders", bitMEXApi.GetOpenOrders(MainClass.pair).Count);
                ds.Tables[1].Rows.Add("Amount", jCointaner[0]["walletBalance"].ToString());


                System.IO.File.Delete(MainClass.location + "bd.xml");
                ds.WriteXml(MainClass.location + "bd.xml");
            }
            catch
            {
            }
        }
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            dataSet1 = new DataSet();
            string path = Server.MapPath("~/App_Data");

            dataSet1.ReadXmlSchema(path + "\\XMLFile1.xsd");
            dataSet1.ReadXml(path + "\\XMLFile1.xml");
            Page.DataBind();
        }
Esempio n. 54
0
 public bool LoadHistoryTable()
 {
     if (File.Exists("history.xml"))
     {
         ApmHistorySet.ReadXml("history.xml");
         return(true);
     }
     return(false);
 }
Esempio n. 55
0
        private BindingSource DataBindingJobsSource()
        {
            System.Data.DataSet ds = new System.Data.DataSet();
            string xmlfileFullPath = Miscellaneous.GetJobXMLFullPath();

            //string rootElement = "Jobs";
            ds.ReadXml(xmlfileFullPath);

            return(new BindingSource(ds.Tables[0], null));
        }
Esempio n. 56
0
 public static void LoadXmlToGrid(System.Windows.Forms.DataGridView grid, string fileName, string tableName)
 {
     if (System.IO.File.Exists(fileName))
     {
         System.Data.DataSet ds = new System.Data.DataSet("Accounts");
         ds.ReadXml(fileName);
         grid.DataSource = ds;
         grid.DataMember = tableName;
     }
 }
Esempio n. 57
0
    private void getCurrency()
    {
        DataTable dtCurrency = new DataTable();
        System.Data.DataSet theDS = new System.Data.DataSet();
        theDS.ReadXml(Server.MapPath("..\\XMLFiles\\Currency.xml"));
        DataView theCurrDV = new DataView(theDS.Tables[0]);
        theCurrDV.RowFilter = "Id=" + Convert.ToInt32(Session["AppCurrency"]);
        string thestringCurrency = theCurrDV[0]["Name"].ToString();
        theCurrency = thestringCurrency.Substring(thestringCurrency.LastIndexOf("(") + 1, 3);

    }
Esempio n. 58
0
        private BindingSource NursesDataBindingSource()
        {
            System.Data.DataSet ds = new System.Data.DataSet();
            string fileLocation    = System.IO.Path.Combine(APPPATH, "data");
            string xmlFileName     = "Nursers.xml";
            string xmlfileFullPath = System.IO.Path.Combine(fileLocation, xmlFileName);

            ds.ReadXml(xmlfileFullPath);

            return(new BindingSource(ds.Tables[0], null));
        }
Esempio n. 59
0
 public Form1()
 {
     InitializeComponent();
     // This line of code is generated by Data Source Configuration Wizard
     // Create a new DataSet
     System.Data.DataSet xmlDataSet = new System.Data.DataSet("XML DataSet");
     // Load the XML document to the DataSet
     xmlDataSet.ReadXml(@"..\..\Data\rio2016.xml");
     // This line of code is generated by Data Source Configuration Wizard
     pieChartDataAdapter1.DataSource = xmlDataSet.Tables["Table1"];
 }
Esempio n. 60
0
        /// <summary>
        /// 通过SOAP协议动态调用webservice
        /// </summary>
        /// <param name="url"> webservice地址</param>
        /// <param name="methodName"> 调用方法名</param>
        /// <param name="pars"> 参数表</param>
        /// <returns> 结果集转换的DataSet</returns>
        public static DataSet SoapWebServiceDataSet(String url, String methodName, Hashtable pars)
        {
            XmlDocument doc = SoapWebService(url, methodName, pars);

            System.Data.DataSet ds = new System.Data.DataSet();
            using (XmlNodeReader reader = new XmlNodeReader(doc))
            {
                ds.ReadXml(reader);
            }
            return(ds);
        }