C#
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Windows.Forms;
namespace regedit
{
/// <summary>
/// Picture 的摘要描述。
/// </summary>
public class Picture : System.Windows.Forms.Form
{
private System.Windows.Forms.OpenFileDialog openFileDlg;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btnBrowse;
private System.Windows.Forms.TextBox txtfile;
private System.Windows.Forms.Button btnInsert;
private System.Windows.Forms.TextBox txtname;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.PictureBox pictureBox1;
/// <summary>
/// 設計工具所需的變數。
/// </summary>
private System.ComponentModel.Container components = null;
SqlConnection conn=new SqlConnection("Data Source=localhost; Integrated Security=SSPI;Initial Catalog=mis");
public Picture()
{
//
// Windows Form 設計工具支援的必要項
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 呼叫之後加入任何建構函式程式碼
//
}
/// <summary>
/// 清除任何使用中的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form 設計工具產生的程式碼
/// <summary>
/// 此為設計工具支援所必須的方法 - 請勿使用程式碼編輯器修改
/// 這個方法的內容。
/// </summary>
private void InitializeComponent()
{
this.openFileDlg = new System.Windows.Forms.OpenFileDialog();
this.label1 = new System.Windows.Forms.Label();
this.txtfile = new System.Windows.Forms.TextBox();
this.btnBrowse = new System.Windows.Forms.Button();
this.btnInsert = new System.Windows.Forms.Button();
this.txtname = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(16, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(72, 23);
this.label1.TabIndex = 0;
this.label1.Text = "ImageName";
//
// txtfile
//
this.txtfile.Location = new System.Drawing.Point(88, 16);
this.txtfile.Name = "txtfile";
this.txtfile.Size = new System.Drawing.Size(384, 22);
this.txtfile.TabIndex = 1;
this.txtfile.Text = "";
//
// btnBrowse
//
this.btnBrowse.Location = new System.Drawing.Point(24, 48);
this.btnBrowse.Name = "btnBrowse";
this.btnBrowse.TabIndex = 2;
this.btnBrowse.Text = "Browse";
this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
//
// btnInsert
//
this.btnInsert.Location = new System.Drawing.Point(112, 48);
this.btnInsert.Name = "btnInsert";
this.btnInsert.TabIndex = 3;
this.btnInsert.Text = "Insert";
this.btnInsert.Click += new System.EventHandler(this.btnInsert_Click);
//
// txtname
//
this.txtname.Location = new System.Draw