Mysql 4.06 cannot insert image through Ole
Hi
I am new to mysql, I created a table
CREATE TABLE `image_data` (
`image_id` INT AUTO_INCREMENT ,
`image_Data` LONGBLOB,
PRIMARY KEY ( `image_id` )
);
using c# ole i am trying to insert a image data into image_data filed
<code>
string path = Server.MapPath("./tmp/Image1.tif");
FileStream fs = new FileStream(path,FileMode.Open,FileAccess.Read);
byte[] Mydata = new byte[fs.Length];
fs.Read(Mydata,0,(int)fs.Length);
fs.Close();
string myConnectionString = "Provider=MySqlProv;Data Source=Database_Name;User ID=User_Name;Location=Server_Name;Password=Password;";
OleDbConnection mydb = new OleDbConnection(myConnectionString);
OleDbCommand c = new OleDbCommand("INSERT INTO `Image_Data` (`Image_Data` ) VALUES (@Image_Data)" , mydb);
OleDbParameter Param = new OleDbParameter("@Image_Data",OleDbType.Binary) ;
Param.Value = Mydata ;
c.Parameters.Add(Param);
mydb.Open();
c.ExecuteNonQuery();
mydb.Close();
</code>
Subject
Written By
Posted
Mysql 4.06 cannot insert image through Ole
December 14, 2004 09:57AM
December 15, 2004 05:01PM
December 21, 2004 10:54AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.