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
Dorababu Meka
218
8.3k
1.7m
Blob In SQL
May 28 2009 2:39 AM
Hi i use the following code to get the image from SQL database
string sConn = @"Data Source=SYSTEM1;Initial Catalog=BLOBTest4;Integrated Security=True";
SqlConnection objConn = new SqlConnection(sConn);
objConn.Open();
string sTSQL = "SELECT TheName FROM FileInfo";
SqlCommand objCmd = new SqlCommand(sTSQL, objConn);
objCmd.CommandType = CommandType.Text;
SqlDataReader dr = objCmd.ExecuteReader();
dr.Read();
Response.BinaryWrite((byte[])dr["TheName"]);
objConn.Close();
My SQL table is as follows
column name : The Name Datatype : varchar
column name : Dirpath Datatype : varchar
I am geeting the following error can any one rectify this error
Unable to cast object of type 'System.String' to type 'System.Byte[]'.
Reply
Answers (
8
)
Windows based apilcation
Help