数据存取、转换问题,请各位指教
private void button2_Click(object sender, EventArgs e)
{
//找图片
//取得textbox中的数
string num = textBox1.Text;
string conn = ( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\test.mdb; ");
OleDbConnection myconn = new OleDbConnection(conn);
string query = "select * from graph where id= ' " + num + " ' ";
OleDbCommand mycommand = new OleDbCommand(query, myconn);
//取图片
try
{
myconn.Open();
}
catch
{
MessageBox.Show( " 不能打开数据联接! ");
}
OleDbDataReader dr = mycommand.ExecuteReader();
MessageBox.Show( "图片已找到! ");
if (dr.Read())
{
byte[] mydata = (byte[])dr[ "photo "]; //缓冲区
int len = mydata.Length; //缓冲区长度
FileStream fs = new FileStream( "E:\\6.jpg ", FileMode.Create, FileAccess.Write);
&