日期:2012-04-01  浏览次数:20530 次

////////////////////////////////////////////////////////////////////////////////
//Author: stardicky //
//E-mail: stardicky@hotmail.com //
//QQNumber: 9531511 //
//CompanyName: Ezone International //
//Class: HBS-0308 //
//title: 如何在 SQL Server2000 中保存保存图像及读取图像信息 //
////////////////////////////////////////////////////////////////////////////////
//注意:运行这实例的之前需要在查询分析器中执行下列SQL语句: //
//CREATE DATABASE EzoneDb //
//go //
//USE EzoneDb //
//go //
//CREATE TABLE [Images] ( //
//[ImageID] [int] IDENTITY (1, 1) NOT NULL , //
//[Description] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , //
//[ImageFile] [image] NULL , //
//[ImageSize] [int] NULL , //
//[ImageType] [nvarchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL //
//) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] //
//GO //
////////////////////////////////////////////////////////////////////////////////

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.IO;

namespace EzoneImageInSQL
{
public class frmMain : System.Windows.Forms.Form
{
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Data.SqlClient.SqlConnection MySqlCon;
private System.Windows.Forms.Label labFilePath;
private System.Windows.Forms.TextBox txtFilePath;
private System.Windows.Forms.Button btnUpload;
private System.Windows.Forms.PictureBox ImgPictureBox;
private System.Windows.Forms.Button btnDownLoad;
private System.Windows.Forms.Label labDescription;
private System.Windows.Forms.TextBox txtImage;

private System.ComponentModel.Container components = null;

public frmMain()
{

InitializeComponent();

}

protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

private void InitializeComponent()
{
this.labFilePath = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.txtFilePath = new System.Windows.Forms.TextBox();
this.btnUpload = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.ImgPictureBox = new System.Windows.Forms.PictureBox();
this.btnDownLoad = new System.Windows.Forms.Button();
this.MySqlCon = new System.Data.SqlClient.SqlConnection();
this.labDescription = new System.Windows.Forms.Label();
this.txtImage = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// labFilePath
//
this.labFilePath.Locatio