Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. image inside gridview

image inside gridview

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpdatabasemysql
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aditi000
    wrote on last edited by
    #1

    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 ===================

    R R 2 Replies Last reply
    0
    • A aditi000

      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 ===================

      R Offline
      R Offline
      rihdus
      wrote on last edited by
      #2

      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...

      1 Reply Last reply
      0
      • A aditi000

        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 ===================

        R Offline
        R Offline
        rohitsrivastava
        wrote on last edited by
        #3

        hi aditi your image datatype u can take binary your problem is solve have a nice day

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups