日期:2014-05-17 浏览次数:20755 次
if (Pic1.Image == null)
{
MessageBox.Show("请选择要保存的图像!");
}
else
{
try
{
string fullpath = op.FileName;
FileStream fs = new FileStream(fullpath, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
byte[] imagebytes = br.ReadBytes((int)fs.Length);
SetConnection();
SQLiteCommand com = sql_con.CreateCommand();
sql_con.Open();
com.CommandText = "insert into ImageStore(ImageBlob) values(@image)";
com.Parameters.AddWithValue("@image", imagebytes);
int Flag = 0;
Flag += com.ExecuteNonQuery();
sql_con.Close();
if (Flag == 1)
{
MessageBox.Show("图片保存成功!");
Pic1.Image = null;
getMaxValue();
}
else
&n