error while retriving an image from Firebied database
-
Hi iam in windows application in c# my database is "Firebird Database"; iam saving an picture into database.but iam unable to retrive same picture from database mycode is : This code is in DataAccess layer. string query = "select photo from cust1 where id=" + id; FbDataAdapter adb = new FbDataAdapter(query, cnn); DataSet ds = new DataSet(); adb.Fill(ds, "cust1"); if (ds.Tables[0].Rows.Count > 0) { DataRow dr; dr = ds.Tables[0].Rows[0]; if (!dr["photo"].Equals(DBNull.Value)) { byte[] content = (byte[])dr["photo"]; MemoryStream stream = new MemoryStream(content); photo = stream; } } Bitmap img = new Bitmap(objcls.photo);---------------"ERROR" pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; pictureBox1.Image = img; it is giving error "parameter is not valid" please inform where the exact problem is
murali krishna
-
Hi iam in windows application in c# my database is "Firebird Database"; iam saving an picture into database.but iam unable to retrive same picture from database mycode is : This code is in DataAccess layer. string query = "select photo from cust1 where id=" + id; FbDataAdapter adb = new FbDataAdapter(query, cnn); DataSet ds = new DataSet(); adb.Fill(ds, "cust1"); if (ds.Tables[0].Rows.Count > 0) { DataRow dr; dr = ds.Tables[0].Rows[0]; if (!dr["photo"].Equals(DBNull.Value)) { byte[] content = (byte[])dr["photo"]; MemoryStream stream = new MemoryStream(content); photo = stream; } } Bitmap img = new Bitmap(objcls.photo);---------------"ERROR" pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; pictureBox1.Image = img; it is giving error "parameter is not valid" please inform where the exact problem is
murali krishna
avvaru.murali wrote:
please inform where the exact problem is
We can't tell you the "exact" anything unless you explain your problem better. You need to give us more information: What is photo? What is the error?
Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * Different ways to add point data in SQL Server 2008 * Spatial References in SQL Server 2008 My website |