Storing files to database and downloading it using ASP.NET

1) First create a new column and set it as varbinary(MAX) for the datatype. 2) Use this code to store the file to database:             //Read File to Bytes                     FileStream st = new FileStream(<Location of the file>, FileMode.Open);                     byte[] fileData= new byte[st.Length];                     st.Read(fileData, 0, (int)st.Length);                     st.Close();                     SqlParameter[] param = new SqlParameter[] { new SqlParameter("@ID",<Reference ID>),                                                     new SqlParameter("@Data",fileData)  };             int i = SqlAccessor.ExecuteNonQuery(<ConnectionString>, SqlAccessor.SqlCommandBuilder(new SqlCommand (<Stored Procedure Name>), param), CommandType.StoredProcedure, out retVal);  I've used Application Blocks to simplify data operation. To Retrieve the data and to be downloaded from an ASP.NET Page: 3)  I created a function that returns a byte array with ID as parameter  public static...

posted @ Thursday, November 20, 2008 4:59 PM | Feedback (1)
N-Tier Web Applications using ASP.NET 2.0 and SQL Server 2005

Been looking for articles on how to implement a N-tier Web applications using ASP.NET 2.0 and SQL 2005 and I think this article clearly provide techniques and samples on how to.

posted @ Monday, February 19, 2007 6:02 PM | Feedback (4)

Microsoft recently released the v. 1.0 of ASP.NET AJAX "Atlas" and I've attended a demo about Atlas and find it really cool. Just simple drag and drop, cut and paste viola... you have an AJAX enabled website. It also include AJAX toolkit (extenders) which can be downloaded for free. Microsoft offers new certification for ASP.NET Developers named MCDDP which stands for Microsoft Ceritified Drag-and-Drop Professional..

posted @ Thursday, February 15, 2007 12:26 PM | Feedback (1)