Torna al Thread

FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); FileInfo fi = new FileInfo(path); byte[] imagedata = new byte[fs.Length]; fs.Read(imagedata, 0, (int)fs.Length); try { MyString = "UPDATE tabAllegatiCommessa SET ContenutoFile=(?) where NomeFile='" + NomeFile + "'"; OleDbCommand InsertImage = new OleDbCommand(MyString, connection); OleDbParameter myParm2 = new OleDbParameter("?P1", SqlDbType.Image); myParm2.Value = imagedata; //is byte[] InsertImage.Parameters.Add(myParm2); connection.Open(); InsertImage.ExecuteNonQuery(); connection.Close(); br.Close(); fs.Close(); } catch (Exception ex) { Response.Write(ex.Message); }
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5