Click here to Skip to main content
15,917,320 members

Comments by Member 10715787 (Top 2 by date)

Member 10715787 23-Jul-15 8:20am View    
go through the following URL-
http://www.c-sharpcorner.com/UploadFile/a20beb/retrieve-image-from-the-database-in-Asp-Net/


using (SqlConnection conn = ...)
{
conn.Open();

using (SqlCommand cmd = new SqlCommand("SELECT Picture FROM <tableName> WHERE ...", conn)
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader.Read())
{
byte[] picData= reader["Picture"] as byte[] ?? null;

if (picData!= null)
{
using (MemoryStream ms = new MemoryStream(picData))
{
// Load the image from the memory stream. How you do it depends
// on whether you're using Windows Forms or WPF.
// For Windows Forms you could write:
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(ms);
}
}
}
}
}
Member 10715787 24-Apr-14 9:37am View    
Hi I am able to find the below result using pivot..
X 12-01-2013 12-02-2013 12-03-2013
BR00002 2.22 1.65 1.8

But i could not be able to Sum(Y) in the query.
I am using the following query to find the above result-
Select * FROM
(
SELECT A as X,SUM(C)as N,D group by X,D
)as s
PIVOT
(
SUM(C)
FOR D IN([12-01-2013],[12-02-2013],[12-03-2013])
) as pvt

Please help me to get the SUM of column(B) in same SP..
Please help..