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. Web Development
  3. ASP.NET
  4. datagridview

datagridview

Scheduled Pinned Locked Moved ASP.NET
cssdatabasequestion
7 Posts 6 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.
  • P Offline
    P Offline
    ptvce
    wrote on last edited by
    #1

    i have a dataGrid view in my windows form and now i want bind it programatically. i write this code:: string ConnString = ""; sqlConnection conn = new SqlConnection (ConnString); string sql = ""; sqlDataAdapter da = new SqlDataAdapter(sql,conn); conn.open()l dataset ds = new dataset(); da.fill(ds); conn.close(); datagridview1.DataSource = ds; my code is right and ds hase 1 record and fill right but my grid dont show any record do u know why? has anything that i dont

    T S R T 4 Replies Last reply
    0
    • P ptvce

      i have a dataGrid view in my windows form and now i want bind it programatically. i write this code:: string ConnString = ""; sqlConnection conn = new SqlConnection (ConnString); string sql = ""; sqlDataAdapter da = new SqlDataAdapter(sql,conn); conn.open()l dataset ds = new dataset(); da.fill(ds); conn.close(); datagridview1.DataSource = ds; my code is right and ds hase 1 record and fill right but my grid dont show any record do u know why? has anything that i dont

      T Offline
      T Offline
      thatraja
      wrote on last edited by
      #2

      your code is incomplete. Add the following line end of your code.

      datagridview1.Databind();

      thatraja


      Tips/Tricks|Brainbench certifications|Facebook|Twitter

      P 1 Reply Last reply
      0
      • T thatraja

        your code is incomplete. Add the following line end of your code.

        datagridview1.Databind();

        thatraja


        Tips/Tricks|Brainbench certifications|Facebook|Twitter

        P Offline
        P Offline
        ptvce
        wrote on last edited by
        #3

        but my form is windows form not web form and it has no databind, what is insted of that in windows form?

        N 1 Reply Last reply
        0
        • P ptvce

          i have a dataGrid view in my windows form and now i want bind it programatically. i write this code:: string ConnString = ""; sqlConnection conn = new SqlConnection (ConnString); string sql = ""; sqlDataAdapter da = new SqlDataAdapter(sql,conn); conn.open()l dataset ds = new dataset(); da.fill(ds); conn.close(); datagridview1.DataSource = ds; my code is right and ds hase 1 record and fill right but my grid dont show any record do u know why? has anything that i dont

          S Offline
          S Offline
          Sandeep Mewara
          wrote on last edited by
          #4

          1. Don't cross post at multiple forums. Pick one and stick to it. Repost[^]

          1 Reply Last reply
          0
          • P ptvce

            i have a dataGrid view in my windows form and now i want bind it programatically. i write this code:: string ConnString = ""; sqlConnection conn = new SqlConnection (ConnString); string sql = ""; sqlDataAdapter da = new SqlDataAdapter(sql,conn); conn.open()l dataset ds = new dataset(); da.fill(ds); conn.close(); datagridview1.DataSource = ds; my code is right and ds hase 1 record and fill right but my grid dont show any record do u know why? has anything that i dont

            R Offline
            R Offline
            raju melveetilpurayil
            wrote on last edited by
            #5

            datagridview1.DataSource = ds.Tables[0];

            1 Reply Last reply
            0
            • P ptvce

              but my form is windows form not web form and it has no databind, what is insted of that in windows form?

              N Offline
              N Offline
              nagendrathecoder
              wrote on last edited by
              #6

              ptvce wrote:

              but my form is windows form not web form

              Then why you posted this question in ASP.Net forum, you should have posted it in C# forum.

              1 Reply Last reply
              0
              • P ptvce

                i have a dataGrid view in my windows form and now i want bind it programatically. i write this code:: string ConnString = ""; sqlConnection conn = new SqlConnection (ConnString); string sql = ""; sqlDataAdapter da = new SqlDataAdapter(sql,conn); conn.open()l dataset ds = new dataset(); da.fill(ds); conn.close(); datagridview1.DataSource = ds; my code is right and ds hase 1 record and fill right but my grid dont show any record do u know why? has anything that i dont

                T Offline
                T Offline
                Tej Aj
                wrote on last edited by
                #7

                If ur query returns multiple tables then use

                datagridview1.DataSource = ds.Tables[0];

                or

                datagridview1.DataSource = ds;
                datagridview1.DataMember = ds.Tables[0];

                Tej Aj, http://opexsolution.com/forum/[^] Fan of: http://www.abtstudioz.com/[^]

                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