Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 4.0 使用se获取您的价值观_C# 4.0 - Fatal编程技术网

C# 4.0 使用se获取您的价值观

C# 4.0 使用se获取您的价值观,c#-4.0,C# 4.0,完成XML DB Config Reader类后,每次需要新连接时都会使用它,只需更改DB Config XML文件即可更改DB Connections配置 编辑:这里有一篇有趣的文章。请参阅:请参阅:使用默认值 C#支持的 使用默认值 C#支持的 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using

完成XML DB Config Reader类后,每次需要新连接时都会使用它,只需更改DB Config XML文件即可更改DB Connections配置

编辑:这里有一篇有趣的文章。

请参阅:

请参阅:

使用默认值

C#支持的

使用默认值

C#支持的

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 MySql.Data.MySqlClient;
using System.Web;
using mshtml;


namespace tabcontrolweb
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

         }


        private void Form1_Load(object sender, EventArgs e)
        {
            string MyConString = "SERVER=192.168.0.78;" +
                 "DATABASE=webboard;" +
                 "UID=aimja;" +
                 "PASSWORD=aimjawork;" +
                 "charset=utf8;";
            MySqlConnection connection = new MySqlConnection(MyConString);
            MySqlCommand command = connection.CreateCommand();
            MySqlDataReader Reader;
            command.CommandText = "SELECT  urlwebboard FROM `listweb` WHERE `urlwebboard` IS NOT NULL AND ( `webbordkind` = 'เว็บท้องถิ่น' ) and `nourl`= 'n' order by province, amphore limit 4 ";
            connection.Open();
            Reader = command.ExecuteReader();


            string[] urls = new string[4];
            string thisrow = "";
            string sumthisrow = "";

            while (Reader.Read())
            {
                thisrow = "";

                for (int i = 0; i < Reader.FieldCount; i++)
                {
                    thisrow += Reader.GetValue(i).ToString();


                    System.IO.File.AppendAllText(@"C:\file.txt", thisrow + " " + Environment.NewLine);
                    sumthisrow = Reader.GetValue(Reader.FieldCount - 1).ToString();

                }

                for (int m = 0; m < 4 ; m++)
                {
                    urls[m] = sumthisrow;
                    MessageBox.Show(urls[m]);          
                }

                webBrowser1.Navigate(new Uri(urls[0]));
                webBrowser1.Dock = DockStyle.Fill;
                webBrowser2.Navigate(new Uri(urls[1]));
                webBrowser2.Dock = DockStyle.Fill;
                webBrowser3.Navigate(new Uri(urls[2]));
                webBrowser3.Dock = DockStyle.Fill;
                webBrowser4.Navigate(new Uri(urls[3]));
                webBrowser4.Dock = DockStyle.Fill;


            }



            connection.Close();


        }



        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            //if (webBrowser1.Document != null)
            //{
            //    IHTMLDocument2 document = webBrowser1.Document.DomDocument as IHTMLDocument2;
            //    if (document != null)
            //    {
            //        IHTMLSelectionObject currentSelection = document.selection;

            //        IHTMLTxtRange range = currentSelection.createRange() as IHTMLTxtRange;
            //        if (range != null)
            //        {
            //            const String search = "We";

            //            if (range.findText(search, search.Length, 2))
            //            {
            //                range.select();
            //            }
            //        }
            //    }
            //}
        }


    }
}
<db-config>
    <server>192.168.0.78</server>
    <database>webboard</database>
    <...>...</...>
</db-config>
using System;
using System.Xml;
namespace ReadXMLfromFile
{
    /// <summary>
    /// Summary description for Class1.
    /// </summary>
    class Class1
    {
        static void Main(string[] args)
        {
            XmlTextReader reader = new XmlTextReader ("books.xml");
            while (reader.Read()) 
            {
                switch (reader.NodeType) 
                {
                    case XmlNodeType.Element: // The node is an element.
                        Console.Write("<" + reader.Name);
                        Console.WriteLine(">");
                        break;
                    case XmlNodeType.Text: //Display the text in each element.
                        Console.WriteLine (reader.Value);
                        break;
                    case XmlNodeType.EndElement: //Display the end of the element.
                        Console.Write("</" + reader.Name);
                        Console.WriteLine(">");
                        break;
                }
            }
            Console.ReadLine();
        }
    }
}