create table test
{
id int identity(1,1),
FImage image
}
相关的存储过程
Create proc UpdateImage (@UpdateImage Image)
As
Insert Into test (FImage) values (@UpdateImage)
GO
OpenFileDialog openfileDialog = new OpenFileDialog();
openfileDialog.Filter = "Picture Files(*.jpg)|*.jpg|Bmp(*.bmp)|*.bmp|All Files(*.*)|*.*";
FileStream fileStream;
openfileDialog.ShowDialog();
string filepath = openfileDialog.FileName;
if (filepath.Trim() != "")
{
//获得图象并把图象转换为byte[]
fileStream = new FileStream(filepath, FileMode.Open, FileAccess.Read);
byte[] photoArray = new byte[(int)fileStream.Length];
fileStream.Read(photoArray, 0, photoArray.Length);
fileStream.Close();
try
{
pictureBox1.SizeMode = PictureBoxSizeMode.Normal;
pictureBox1.Image = System.Drawing.Image.FromFile(filepath);
}
catch (Exception ex)
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余2页未读,立即下载