TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sunny Chan
NA
5
5.3k
Retrieve file from database
Jul 27 2011 1:41 AM
%
@
WebHandler
Language
="C#"
Class
="Handler"
%>
using
System;
using
System.Web;
using
System.Data;
using
System.Data.SqlClient;
public
class
Handler
:
IHttpHandler
{
const
string
Con_string =
@"Data Source=DESKTOP10\SQLEXPRESS;Initial Catalog=Office;Integrated Security=True"
;
public
void
ProcessRequest(
HttpContext
context)
{
context.Response.ContentType =
"application/msword"
;
SqlConnection
con =
new
SqlConnection
(Con_string);
SqlCommand
cmd =
new
SqlCommand
(
"Select * from Resource where id=@id"
);
cmd.Parameters.AddWithValue(
"@id"
, context.Request[
"id"
]);
using
(con)
{
con.Open();
byte
[] file = (
byte
[])cmd.ExecuteScalar();
context.Response.BinaryWrite(file);
}
}
public
bool
IsReusable
{
get
{
return
false
;
}
}
}
I got below error. What should i do to solve this?
Reply
Answers (
2
)
GridView selected row has no data
Crystal Report