先使用这种方法进行插入,然后才读出,不能先使用ACCESS功能插入,然后读出.private void btnShow_Click(object sender, System.EventArgs e)
{

string SQL="SELECT * FROM test1 ";

string ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source = E:\\myvc\\testdb.mdb";
OleDbConnection conn=new OleDbConnection(ConnectionString);
OleDbCommand cmd=conn.CreateCommand();
cmd.CommandText=SQL;
conn.Open();
OleDbDataReader dr=cmd.ExecuteReader(); if(dr.Read())
{
string strFile=string.Empty;
strFile=dr.GetString(1);
byte[] by=(byte[])dr.GetValue(2); MemoryStream mss = new MemoryStream(by); this.picImage.Image = Image.FromStream(mss);
}
dr.Close();
conn.Close();}private void btnExit_Click(object sender, System.EventArgs e)
{
Dispose(true);
}private void btnSearch_Click(object sender, System.EventArgs e)
{
Bitmap MyImage ;
string fileToDisplay = "";
OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = "c:\\" ;
openFileDialog1.Filter = "bmp files (*.bmp)|*.bmp|jpg files (*.jpg)|*.jpg|gif files (*.gif)|*.gif" ;
openFileDialog1.FilterIndex = 3 ;
openFileDialog1.RestoreDirectory = true ; if(openFileDialog1.ShowDialog() == DialogResult.OK)
{
fileToDisplay = openFileDialog1.FileName; // Stretches the image to fit the pictureBox.
picImage.SizeMode = PictureBoxSizeMode.StretchImage ;
MyImage = new Bitmap(fileToDisplay);
picImage.Image = (Image) MyImage ;
}}private void btnSave_Click(object sender, System.EventArgs e)
{
string SQL="SELECT * FROM test1 ID = 8";

string ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source = E:\\myvc\\testdb.mdb";
try 
{ OleDbConnection conn=new OleDbConnection(ConnectionString);
OleDbDataAdapter da=new OleDbDataAdapter(SQL,conn);
OleDbCommandBuilder cmd=new OleDbCommandBuilder(da);
DataSet ds=new DataSet(); conn.Open();
da.Fill(ds,"test1");
DataTable dt=ds.Tables[0];
DataRow dr;
if(dt.Rows.Count>0)
dr=dt.Rows[0];
else
dr=dt.NewRow(); dr[1]=txtName.Text;
MemoryStream ms = new MemoryStream ();
picImage.Image.Save (ms, System.Drawing.Imaging.ImageFormat.Bmp);
byte [] myData = new Byte [ms.Length ]; ms.Position = 0;
ms.Read (myData,0,Convert.ToInt32 (ms.Length ));

dr[2] = myData; if(dt.Rows.Count<=0)
dt.Rows.Add(dr);
da.Update(ds, "test1"); conn.Close();
MessageBox.Show("Bmp File Save Success!");
}
catch(System.Exception ee) 
{
MessageBox.Show(ee.Message);
}
}