I'm writing C# 2005 Express Addition, Dot Net Framework(2.0 or 3.0).
But i think if you've idea about c# then you might be able to complete it.
//Have DataAdapter.
{
OracleDataAdapter pAdapter = new OracleDataAdapter("Select * from Employee", con);
}
//Have Dataset
{
DataSet pDataSet = new DataSet("Employee");
}
//Fill Dataset.
{
pAdapter.Fill(pDataSet, "Employee");
}
0).Have a New Row in Dataset.
{
DataRow pRow = pDataSet.Tables["Employee"].NewRow();
}
1). Load the path of Image that you want to store in Oracle(9i)database.
{
if (strImageName1 != "")
{
//Read Access to the file chosed by 'Browse' button.
FileStream fs = new FileStream(@strImageName1, FileMode.Open, FileAccess.Read);
}
}
2). Convert it into Stream of data and keep it into an Array of byte.
{
//Create a byte array of file stream length
byte[] ImageData = new byte[fs.Length];
}
3).
{
//Read block of bytes from stream into byte array
fs.Read(ImageData, 0, System.Convert.ToInt32 fs.Length));
fs.Close();
}
4). Save this stream into your database.
{
//Assigning the byte array containing image data.
pRow["Emp_image"] = ImageData;
}
5). Don't Forget to Add Row into datase.
{
pDataSet.Tables["Employee"].Rows.Add(pRow);
}
6). Don't forget to Update DataAdapter.
{
pAdapter.Update(pDataSet, "Employee");
}
I Hope it works.
If still not clear, don't hesitate to e-mail me.
Mr.Khurram
|