Databases Reference
In-Depth Information
cmd.Prepare();
}
void ExecuteInsertImages(int imageFileNumber)
{
string imageFileName = null;
byte[] imageImageData = null;
imageFileName =
imageFilePrefix + imageFileNumber.ToString() + imageFileType;
imageImageData =
LoadImageFile(imageFileName, imageFileLocation, maxImageSize);
cmd.Parameters["@imagefile"].Value = imageFileName;
cmd.Parameters["@imagedata"].Value = imageImageData;
ExecuteCommand(cmd.CommandText);
}
byte[] LoadImageFile(
string fileName,
string fileLocation,
int maxImageSize
)
{
byte[] imagebytes = null;
string fullpath = fileLocation + fileName;
Console.WriteLine("Loading File:");
Console.WriteLine(fullpath);
FileStream fs = new FileStream(fullpath, FileMode.Open, å
FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
imagebytes = br.ReadBytes(maxImageSize);
Console.WriteLine(
"Imagebytes has length {0} bytes.",
imagebytes.GetLength(0)
);
return imagebytes;
}
}
}
Search WWH ::




Custom Search