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[]'.
Loading

Niradhip ChakrabortyPosted May 29, 2009, 3:13 PM
1.http://www.datamasker.com/SSE2005_NetworkCfg.htm
2.http://www.codeproject.com/KB/database/SQL_Server_2005_remote.aspx
Kishore PalPosted May 29, 2009, 2:52 PM
Dorababu MekaPosted May 28, 2009, 2:57 AM
Dorababu MekaPosted May 28, 2009, 2:57 AM
Suchit KhannaPosted May 28, 2009, 2:55 AM
Dorababu MekaPosted May 28, 2009, 2:48 AM
Suchit KhannaPosted May 28, 2009, 2:47 AM
Suchit KhannaPosted May 28, 2009, 2:45 AM