0
私はデータベースからwebcontrolにURLを入れようとしています。
私は4つのタブコントロールを作成します。各タブコントロールは、Webコントロールで構成されています。私はデータベースから取得したURLを使用したい:
最初のURLはtab1(ブラウザのタブ内)に置かれています...データベースからWebコントロールへのURLの選択
どうすればいいですか?
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 url FROM `listweb` WHERE `url` IS NOT NULL AND (`webbordkind` = 'เว็บท้องถิ่น') and `nourl`= 'n' order by province, amphore limit 4 ";
connection.Open();
Reader = command.ExecuteReader();
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 = sumthisrow + thisrow;
}
connection.Close();
}
this.webBrowser2.Dock = System.Windows.Forms.DockStyle.Fill; this.webBrowser2.Location = new System.Drawing.Point(3、3); this.webBrowser2.MinimumSize = new System.Drawing.Size(20、20); this.webBrowser2.Name = "webBrowser2"; this.webBrowser2.Size =新しいSystem.Drawing.Size(410,420); this.webBrowser2.TabIndex = 0; this.webBrowser2.Url = new System.Uri( "http://www.msn.com"、System.UriKind.Absolute); // – tee