static void func10() { string filename = "D:\\Desert.jpg"; string connstr = @"Persist Security Info=False;uid=sa;pwd=12345;database=EFExample;server=localhost"; ViewDbHelper.StrConn = connstr; ViewDbHelper.Insert2(filename); }
static void func11() { string filename = ""; string connstr = @"Persist Security Info=False;uid=sa;pwd=12345;database=EFExample;server=localhost"; ViewDbHelper.StrConn = connstr; string sql = "select * from Images"; DataTable dt = ViewDbHelper.GetTable(sql); byte[] bs = (byte[])(dt.Rows[0]["Image"]); MemoryStream ms = new MemoryStream(bs); filename = dt.Rows[0]["Name"].ToString(); Image image = Image.FromStream(ms); //ms.Close(); image.Save(filename); ms.Close(); }