Click here to Skip to main content
15,888,461 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: button in Repeater item Pin
Eaverae17-Aug-10 22:56
Eaverae17-Aug-10 22:56 
GeneralRe: button in Repeater item Pin
RongNK17-Aug-10 22:57
RongNK17-Aug-10 22:57 
AnswerRe: button in Repeater item Pin
cramteke30-Aug-10 3:57
cramteke30-Aug-10 3:57 
QuestionForm insertion Pin
hameedsabacode16-Aug-10 20:35
hameedsabacode16-Aug-10 20:35 
AnswerRe: Form insertion Pin
Morgs Morgan16-Aug-10 21:02
Morgs Morgan16-Aug-10 21:02 
GeneralRe: Form insertion Pin
hameedsabacode16-Aug-10 21:24
hameedsabacode16-Aug-10 21:24 
QuestionNinjet and DI Pin
future383916-Aug-10 16:08
future383916-Aug-10 16:08 
QuestionProblem showing image in datagrid Pin
Dhyanga16-Aug-10 9:32
Dhyanga16-Aug-10 9:32 
Hello,

I am trying to store the image to the database and display the image from the database to the dataset. Well I saved image in binary format to store. And when i try to pull that image from the database, it didn't work.

table is:
CREATE TABLE [dbo].[tblFiles](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[Name] [varchar](50) NULL,
	[ContentType] [varchar](50) NULL,
	[Data] [varbinary](max) NULL,
 CONSTRAINT [PK_tblFiles] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO


stored procedure viewtblFiles is:

CREATE PROCEDURE [dbo].[viewtblFiles] 
	
	@ID int
	
	
AS
BEGIN TRANSACTION
	
select Name, ContentType, Data from tblFiles where id=@id

COMMIT TRANSACTION

My code for that is:
SqlConnection cnx1 = new SqlConnection(connection.strCnx);
SqlCommand cmd1 = new SqlCommand("viewtblFiles",cnx1);
SqlDataAdapter sda = new SqlDataAdapter();

cmd1.CommandType = CommandType.StoredProcedure;
cmd1.Parameters.Add("@id", SqlDbType.Int).Value = 4;

DataSet dt = new DataSet();
try
{

    cnx.Open();

    sda.SelectCommand = cmd1;

    sda.Fill(dt,"tblFiles");
    GridView1.DataSource = dt;
    GridView1.DataBind();


}

catch (Exception ex)
{
    string s = ex.ToString();


}

finally
{

    cnx.Close();

    sda.Dispose();

    cnx.Dispose();

}


when the programs runs, it didn't give any error but the dataset doesn't include the image file.. is there any idea to get the image in my dataset along with other fields ??
suchita

AnswerRe: Problem showing image in datagrid Pin
m@dhu16-Aug-10 18:34
m@dhu16-Aug-10 18:34 
QuestionDatabinding ASP.NET gridview using multithreading Pin
afsal qureshi16-Aug-10 5:28
afsal qureshi16-Aug-10 5:28 
AnswerRe: Databinding ASP.NET gridview using multithreading Pin
Ennis Ray Lynch, Jr.16-Aug-10 6:11
Ennis Ray Lynch, Jr.16-Aug-10 6:11 
GeneralRe: Databinding ASP.NET gridview using multithreading Pin
afsal qureshi16-Aug-10 6:21
afsal qureshi16-Aug-10 6:21 
GeneralRe: Databinding ASP.NET gridview using multithreading Pin
Fayu20-Aug-10 10:07
Fayu20-Aug-10 10:07 
QuestionDynamic table Onclick Pin
Morgs Morgan15-Aug-10 23:05
Morgs Morgan15-Aug-10 23:05 
AnswerRe: Dynamic table Onclick Pin
Arun Jacob15-Aug-10 23:21
Arun Jacob15-Aug-10 23:21 
GeneralRe: Dynamic table Onclick Pin
Morgs Morgan15-Aug-10 23:28
Morgs Morgan15-Aug-10 23:28 
AnswerRe: Dynamic table Onclick Pin
Arun Jacob16-Aug-10 0:13
Arun Jacob16-Aug-10 0:13 
GeneralRe: Dynamic table Onclick Pin
Morgs Morgan16-Aug-10 5:44
Morgs Morgan16-Aug-10 5:44 
AnswerRe: Dynamic table Onclick [modified] Pin
raju melveetilpurayil16-Aug-10 0:40
professionalraju melveetilpurayil16-Aug-10 0:40 
GeneralRe: Dynamic table Onclick Pin
Morgs Morgan16-Aug-10 5:43
Morgs Morgan16-Aug-10 5:43 
QuestionPage Load [modified] Pin
moein.serpico15-Aug-10 20:08
moein.serpico15-Aug-10 20:08 
AnswerRe: Page Load Pin
Brij15-Aug-10 20:34
mentorBrij15-Aug-10 20:34 
QuestionIIS Restart issue Pin
Amit Patel198515-Aug-10 19:06
Amit Patel198515-Aug-10 19:06 
AnswerRe: IIS Restart issue Pin
Brij15-Aug-10 21:24
mentorBrij15-Aug-10 21:24 
GeneralRe: IIS Restart issue Pin
Amit Patel198515-Aug-10 21:52
Amit Patel198515-Aug-10 21:52 

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.