T
TJ Meadows via .NET 247
Ok this seemed like a simple task im programming in c# .NET
the problem comes when i try to print a image back out of thedatabase to the browser.
Here is my code:
Response.ContentType = "image/jpeg";
DataSet DS = new DataSet();
// MSSQL Connection
SqlConnection sqlConn = new SqlConnection("SERVER=" +ConfigurationSettings.AppSettings["dbSource"].ToString() +";UID=" +ConfigurationSettings.AppSettings["dbUserName"].ToString() +";PWD=" +ConfigurationSettings.AppSettings["dbPassword"].ToString() +";DATABASE=" +ConfigurationSettings.AppSettings["dbDatabase"].ToString());
// [ProductType] Data Set
SqlDataAdapter sqlDataAdapt = new SqlDataAdapter("SELECT SourceFROM ImageMatrix WHERE GUID = '" + GUID + "'", sqlConn);
sqlDataAdapt.Fill(DS, "Image");
DataTable CurrentTable = DS.Tables[0];
if (CurrentTable.Rows.Count != 0)
{
Response.BinaryWrite((byte[])CurrentTable.Rows[0]["Source"]);
}
Ok yet again the code looks simple enough YET it doesnt work allthat gets printed out to the browser is System.Byte[] its reallyannoying does anyone know why its printing the textSystem.Byte[] vrs the actual image??
Thanks!!
the problem comes when i try to print a image back out of thedatabase to the browser.
Here is my code:
Response.ContentType = "image/jpeg";
DataSet DS = new DataSet();
// MSSQL Connection
SqlConnection sqlConn = new SqlConnection("SERVER=" +ConfigurationSettings.AppSettings["dbSource"].ToString() +";UID=" +ConfigurationSettings.AppSettings["dbUserName"].ToString() +";PWD=" +ConfigurationSettings.AppSettings["dbPassword"].ToString() +";DATABASE=" +ConfigurationSettings.AppSettings["dbDatabase"].ToString());
// [ProductType] Data Set
SqlDataAdapter sqlDataAdapt = new SqlDataAdapter("SELECT SourceFROM ImageMatrix WHERE GUID = '" + GUID + "'", sqlConn);
sqlDataAdapt.Fill(DS, "Image");
DataTable CurrentTable = DS.Tables[0];
if (CurrentTable.Rows.Count != 0)
{
Response.BinaryWrite((byte[])CurrentTable.Rows[0]["Source"]);
}
Ok yet again the code looks simple enough YET it doesnt work allthat gets printed out to the browser is System.Byte[] its reallyannoying does anyone know why its printing the textSystem.Byte[] vrs the actual image??
Thanks!!