01.
using
System;
02.
using
System.Collections.Generic;
03.
using
System.ComponentModel;
04.
using
System.Data;
05.
using
System.Drawing;
06.
using
System.Linq;
07.
using
System.Text;
08.
using
System.Windows.Forms;
09.
using
MySql.Data.MySqlClient;
10.
using
System.IO;
11.
namespace
WindowsFormsApplication2
12.
{
13.
public
partial
class
Form1 : Form
14.
{
15.
public
Form1()
16.
{
17.
InitializeComponent();
18.
}
19.
MySqlConnection connection =
new
MySqlConnection(
""
);
20.
MySqlCommand command;
21.
MySqlDataAdapter da;
22.
23.
24.
private
void
button1_Click(
object
sender, EventArgs e)
25.
{
26.
string
query =
"select * from files where ID= '"
+ textBoxID.Text +
"'"
;
27.
command =
new
MySqlCommand(query, connection);
28.
da =
new
MySqlDataAdapter(command);
29.
DataTable dt =
new
DataTable();
30.
da.Fill(dt);
31.
textBoxID.Text = dt.Rows[0][0].ToString();
32.
33.
byte
[] img = (
byte
[])dt.Rows[0][3];
34.
MemoryStream ms =
new
MemoryStream(img);
35.
pictureBox1.Image = Image.FromStream(ms);
36.
da.Dispose();
37.
}
38.
39.
40.
รบกวนช่วยทีนะครับ
41.
42.
43.
}
44.
}