image inside gridview
-
Hello, I am using C# ,APS.NET,MYSQL In my database I have got 4 field PictureFilefile_id type int, PictureFilePictfile_name type varchar, PictureFilefile_size int , file MEDIUMBLOB I have the following code to fetch the details from database ======================================================================== MySql.Data.MySqlClient.MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection(); MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(); MySql.Data.MySqlClient.MySqlDataReader myData ; string SQL; UInt32 FileSize; byte[] rawData; FileStream fs; conn.ConnectionString = CreateConnStr ("127.0.0.1", "dbourwebsite", "root", "root", "3306"); //SQL = "SELECT file_name, file_size, file FROM file"; SQL = "SELECT PictureFilefile_id, PictureFilePictfile_name, PictureFilefile_size, file FROM tblpicturefile where PictureFilefile_id=1"; try { conn.Open(); cmd.Connection = conn; cmd.CommandText = SQL; myData = cmd.ExecuteReader(); DataTable dtPictureTable = new DataTable(); dtPictureTable.Load(myData); GridView1.DataSource = dtPictureTable; GridView1.DataBind(); if (!myData.HasRows) throw new Exception("There are no BLOBs to fetch"); ======================================================================= In the DESING VIEW ===================
-
Hello, I am using C# ,APS.NET,MYSQL In my database I have got 4 field PictureFilefile_id type int, PictureFilePictfile_name type varchar, PictureFilefile_size int , file MEDIUMBLOB I have the following code to fetch the details from database ======================================================================== MySql.Data.MySqlClient.MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection(); MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(); MySql.Data.MySqlClient.MySqlDataReader myData ; string SQL; UInt32 FileSize; byte[] rawData; FileStream fs; conn.ConnectionString = CreateConnStr ("127.0.0.1", "dbourwebsite", "root", "root", "3306"); //SQL = "SELECT file_name, file_size, file FROM file"; SQL = "SELECT PictureFilefile_id, PictureFilePictfile_name, PictureFilefile_size, file FROM tblpicturefile where PictureFilefile_id=1"; try { conn.Open(); cmd.Connection = conn; cmd.CommandText = SQL; myData = cmd.ExecuteReader(); DataTable dtPictureTable = new DataTable(); dtPictureTable.Load(myData); GridView1.DataSource = dtPictureTable; GridView1.DataBind(); if (!myData.HasRows) throw new Exception("There are no BLOBs to fetch"); ======================================================================= In the DESING VIEW ===================
where's code for your image data. something like rawData= (byte[])myData["file"]; and you need to take some template column to display that in Grid. You are missing a lil. see this: http://www.odetocode.com/Articles/172.aspx[^]
Any systematic work reflects its significance for a long time. So let's discuss the best...
-
Hello, I am using C# ,APS.NET,MYSQL In my database I have got 4 field PictureFilefile_id type int, PictureFilePictfile_name type varchar, PictureFilefile_size int , file MEDIUMBLOB I have the following code to fetch the details from database ======================================================================== MySql.Data.MySqlClient.MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection(); MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(); MySql.Data.MySqlClient.MySqlDataReader myData ; string SQL; UInt32 FileSize; byte[] rawData; FileStream fs; conn.ConnectionString = CreateConnStr ("127.0.0.1", "dbourwebsite", "root", "root", "3306"); //SQL = "SELECT file_name, file_size, file FROM file"; SQL = "SELECT PictureFilefile_id, PictureFilePictfile_name, PictureFilefile_size, file FROM tblpicturefile where PictureFilefile_id=1"; try { conn.Open(); cmd.Connection = conn; cmd.CommandText = SQL; myData = cmd.ExecuteReader(); DataTable dtPictureTable = new DataTable(); dtPictureTable.Load(myData); GridView1.DataSource = dtPictureTable; GridView1.DataBind(); if (!myData.HasRows) throw new Exception("There are no BLOBs to fetch"); ======================================================================= In the DESING VIEW ===================
hi aditi your image datatype u can take binary your problem is solve have a nice day