Click here to Skip to main content
15,926,959 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Dynamic WindowsAuthenticated ConnectionString Pin
codelinks29-Aug-07 1:45
codelinks29-Aug-07 1:45 
QuestionDatalist in datagrid Pin
deepu9429-Aug-07 1:10
deepu9429-Aug-07 1:10 
AnswerRe: Datalist in datagrid Pin
Vasudevan Deepak Kumar29-Aug-07 1:39
Vasudevan Deepak Kumar29-Aug-07 1:39 
Questionhey..urgent help needed with makin a site like orkut ... Pin
vishnu_ajit29-Aug-07 0:49
vishnu_ajit29-Aug-07 0:49 
AnswerRe: hey..urgent help needed with makin a site like orkut ... Pin
imranafsari29-Aug-07 0:56
imranafsari29-Aug-07 0:56 
AnswerRe: hey..urgent help needed with makin a site like orkut ... Pin
Sathesh Sakthivel29-Aug-07 0:56
Sathesh Sakthivel29-Aug-07 0:56 
AnswerRe: hey..urgent help needed with makin a site like orkut ... Pin
Vasudevan Deepak Kumar29-Aug-07 1:37
Vasudevan Deepak Kumar29-Aug-07 1:37 
AnswerRe: hey..urgent help needed with makin a site like orkut ... Pin
codelinks29-Aug-07 1:38
codelinks29-Aug-07 1:38 
you can use this code to insert a image


codebehind c#
private void getIMGproperites()
{
HtmlInputFile imageItem = this.FindControl("Img") as HtmlInputFile;
Int32 intImageSize;
string strImageType;
Stream ImageStream;
intImageSize = imageItem.PostedFile.ContentLength;
strImageType = imageItem.PostedFile.ContentType;
ImageStream = imageItem.PostedFile.InputStream;

imageInsert(intImageSize, strImageType, ImageStream, intAlbumId, struseridHome);

}

public static string imageInsert(Int32 intImageSize, string strImageType, Stream ImageStream, Int32 intAlbumId, string struseridHome)
{
string path = "Database=master;Server=noussrv1010;pwd=sa;uid=sa;";
SqlConnection conn = new SqlConnection(path);

string strStatus = MyConstants.StrStatusOne;
byte[] ImageContent = new byte[intImageSize];

int intStatus;
intStatus = ImageStream.Read(ImageContent, 0, intImageSize);
SqlCommand myCommand = new SqlCommand("PNP_Inspic", conn);
myCommand.CommandType = CommandType.StoredProcedure;

SqlParameter imgEmail = new SqlParameter("@Email_ID", SqlDbType.VarChar, 40);
imgEmail.Value = struseridHome;
myCommand.Parameters.Add(imgEmail);

SqlParameter imgAlbumId = new SqlParameter("@PKAlbum_Id", SqlDbType.VarChar, 40);
imgAlbumId.Value = intAlbumId;
myCommand.Parameters.Add(imgAlbumId);

SqlParameter imgImageact = new SqlParameter("@Image_act", SqlDbType.Image);
imgImageact.Value = ImageContent;
myCommand.Parameters.Add(imgImageact);

SqlParameter imgImageType = new SqlParameter("@Image_Type", SqlDbType.VarChar, 255);
imgImageType.Value = strImageType;
myCommand.Parameters.Add(imgImageType);

SqlParameter imgImageSize = new SqlParameter("@Image_Size", SqlDbType.VarChar, 400);
imgImageSize.Value = intImageSize;
myCommand.Parameters.Add(imgImageSize);

SqlParameter imgImageSubdate = new SqlParameter("@Image_Sub_date", SqlDbType.DateTime);
imgImageSubdate.Value = DateTime.Now;
myCommand.Parameters.Add(imgImageSubdate);
try
{
conn.Open();
myCommand.ExecuteNonQuery();
conn.Close();

}
catch (Exception ex)
{
strStatus = MyConstants.StrStatusTwo;
throw ex;
}
finally
{
struseridHome = null;
}
return strStatus;
}

AND THE PROCEDURE to insert the image

--***********************
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PNP_Inspic]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[PNP_Inspic]
GO

/****************************************************************************************************************
Insert/Update data from PNP_UPLOAD_FILES table
***************************************************************************************************************/

CREATE PROCEDURE PNP_Inspic
(
@Email_ID as nVarchar(40),
@PKAlbum_Id as nVarchar(20),
@Image_act as Image,
@Image_Type as nVarchar(255),
@Image_Size as nVarchar(400),
@Image_Sub_date as Datetime
)
AS
BEGIN
INSERT INTO PNP_UPLOAD_FILES(Email_ID,PKAlbum_Id,Image_act,Image_Type,Image_Size,Image_Sub_date)
VALUES(@Email_ID,@PKAlbum_Id,@Image_act,@Image_Type,@Image_Size,@Image_Sub_date)


END

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
---***********************

winnie

GeneralRe: hey..urgent help needed with makin a site like orkut ... Pin
Vasudevan Deepak Kumar29-Aug-07 1:49
Vasudevan Deepak Kumar29-Aug-07 1:49 
GeneralRe: hey..urgent help needed with makin a site like orkut ... Pin
codelinks29-Aug-07 1:52
codelinks29-Aug-07 1:52 
Questionhow to add data to an empty detailsview? Pin
Big Ralph29-Aug-07 0:47
Big Ralph29-Aug-07 0:47 
QuestionHow to add Google search? Pin
Paramhans Dubey29-Aug-07 0:42
professionalParamhans Dubey29-Aug-07 0:42 
AnswerRe: How to add Google search? Pin
Vasudevan Deepak Kumar29-Aug-07 1:34
Vasudevan Deepak Kumar29-Aug-07 1:34 
GeneralRe: How to add Google search? Pin
Paramhans Dubey29-Aug-07 20:48
professionalParamhans Dubey29-Aug-07 20:48 
Questionhow to change behaviour of item_databinding of itemplate interface Pin
imranafsari29-Aug-07 0:39
imranafsari29-Aug-07 0:39 
Questionhow implement barcode in asp.net Pin
puspendra napit29-Aug-07 0:35
puspendra napit29-Aug-07 0:35 
AnswerRe: how implement barcode in asp.net Pin
Sathesh Sakthivel29-Aug-07 1:13
Sathesh Sakthivel29-Aug-07 1:13 
AnswerRe: how implement barcode in asp.net Pin
Christian Graus29-Aug-07 2:02
protectorChristian Graus29-Aug-07 2:02 
Questionhow to find out user name and domain name of a client browing aserver using asp.net Pin
nicetohaveyou29-Aug-07 0:15
nicetohaveyou29-Aug-07 0:15 
AnswerRe: how to find out user name and domain name of a client browing aserver using asp.net Pin
Craster29-Aug-07 1:36
Craster29-Aug-07 1:36 
Questiondatatable doubt Pin
saravanan0528-Aug-07 23:31
saravanan0528-Aug-07 23:31 
AnswerRe: datatable doubt Pin
Michael Sync28-Aug-07 23:42
Michael Sync28-Aug-07 23:42 
QuestionCall a Webservice in Firefox Pin
Abubakarsb28-Aug-07 23:24
Abubakarsb28-Aug-07 23:24 
AnswerRe: Call a Webservice in Firefox [modified] Pin
Michael Sync28-Aug-07 23:39
Michael Sync28-Aug-07 23:39 
GeneralRe: Call a Webservice in Firefox Pin
Vasudevan Deepak Kumar29-Aug-07 1:31
Vasudevan Deepak Kumar29-Aug-07 1:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.