Author: stardickyE-mail: stardicky@hotmail.comQQNumber: 9531511 CompanyName: EzoneInternationalClass: HBS-0308title: how
//////////////////////////////////////// //////////////////////////////////////// // Author: stardicky // Email: stardicky@hotmail.com // QQNumber: 9531511 // CompanyName: Ezone International // Class: HBS-0308 // title: how
//////////////////////////////////////// ////////////////////////////////////////
// Author: stardicky //
// E-mail: stardicky@hotmail.com //
// QQNumber: 9531511 //
// CompanyName: Ezone International //
// Class: HBS-0308 //
// Title: How to save and read image information in SQL server 2000 (a powerful database platform on WINDOWS //
//////////////////////////////////////// ////////////////////////////////////////
// Note: before running this instance, run the following SQL statement in the query Analyzer ://
// 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 [Prima (the most comprehensive VM management system) RY] TEXTIMAGE_ON [Prima (the most comprehensive VM management system) RY] //
// 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 MySQL (the best combination with PHP) Con;
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.txt FilePath = 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. MySQL (the best combination with PHP) Con = new System. Data. SqlClient. SqlConnection ();
This. labDescription = new System. Windows. Forms. Label ();
This.txt Image = new System. Windows. Forms. TextBox ();
This. groupBox1.SuspendLayout ();
This. groupBox2.SuspendLayout ();
This. SuspendLayout ();
//
// LabFilePath
//
This. labFilePath. Location = new System. Drawing. Point (8, 72 );
This. labFilePath. Name = "labFilePath ";
This. labFilePath. Size = new System. Drawing. Size (80, 16 );
This. labFilePath. TabIndex = 0;
This. labFilePath. Text = "file path :";
This. labFilePath. TextAlign = System. Drawing. ContentAlignment. MiddleLeft;
//
// GroupBox1
//
This.groupBox1.Controls.Add(this.txt Image );
This. groupBox1.Controls. Add (this. labDescription );
This. groupBox1.Controls. Add (this. btnUpload );
This.groupBox1.Controls.Add(this.txt FilePath );
This. groupBox1.Controls. Add (this. labFilePath );
This. groupBox1.Location = new System. Drawing. Point (8, 8 );
This. groupBox1.Name = "groupBox1 ";
This. groupBox1.Size = new System. Drawing. Size (280,128 );
This. groupBox1.TabIndex = 1;
This. groupBox1.TabStop = false;
This. groupBox1.Text = "uploading files to the Database ";
//
// TxtFilePath
//
This.txt FilePath. Location = new System. Drawing. Point (72, 64 );
This.txt FilePath. Name = "txtFilePath ";
This.txt FilePath. Size = new System. Drawing. Size (200, 21 );
This.txt FilePath. TabIndex = 1;
This.txt FilePath. Text = "";
//
// BtnUpload
//
This. btnUpload. Location = new System. Drawing. Point (192, 96 );
This. btnUpload. Name = "btnUpload ";
This. btnUpload. TabIndex = 2;
This. btnUpload. Text = "Start upload ";
This. btnUpload. Click + = new System. EventHandler (this. btnUpload_Click );
//
// GroupBox2
//
This. groupBox2.Controls. Add (this. btnDownLoad );
This. groupBox2.Controls. Add (this. ImgPictureBox );
This. groupBox2.Location = new System. Drawing. Point (8,144 );
This. groupBox2.Name = "groupBox2 ";
This. groupBox2.Size = new System. Drawing. Size (280,200 );
This. groupBox2.TabIndex = 2;
This. groupBox2.TabStop = false;
This. groupBox2.Text = "Download image files from the database and preview images ";
//
// ImgPictureBox
//
This. ImgPictureBox. Location = new System. Drawing. Point (16, 24 );
This. ImgPictureBox. Name = "ImgPictureBox ";
This. ImgPictureBox. Size = new System. Drawing. Size (168,160 );
This. ImgPictureBox. SizeMode = System. Windows. Forms. PictureBoxSizeMode. StretchImage;
This. ImgPictureBox. TabIndex = 0;
This. ImgPictureBox. TabStop = false;
//
// BtnDownLoad
//
This. btnDownLoad. Location = new System. Drawing. Point (192, 24 );
This. btnDownLoad. Name = "btnDownLoad ";
This. btnDownLoad. TabIndex = 1;
This. btnDownLoad. Text = "Start download ";
This. btnDownLoad. Click + = new System. EventHandler (this. btnDownLoad_Click );
//
// MySQL (the best combination with PHP) connection object of Con Database
//
This. MySQL (best combination with PHP) Con. ConnectionString = "integrated security = SSPI; data source = ..; persist security info = False; initial catalog = ezonedb ";
//
// LabDescription
//
This. labDescription. Location = new System. Drawing. Point (8, 32 );
This. labDescription. Name = "labDescription ";
This. labDescription. Size = new System. Drawing. Size (88, 16 );
This. labDescription. TabIndex = 3;
This. labDescription. Text = "file Description :";
This. labDescription. TextAlign = System. Drawing. ContentAlignment. MiddleLeft;
//
// TxtImage
//
This.txt Image. Location = new System. Drawing. Point (96, 24 );
This.txt Image. Name = "txtImage ";
This.txt Image. Size =