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. C#
  4. Windows Form Datagridview

Windows Form Datagridview

Scheduled Pinned Locked Moved C#
csharpdebuggingquestion
7 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.
  • R Offline
    R Offline
    Rajeshwar Code Developer
    wrote on last edited by
    #1

    Hi Every one, now i m using window forms using C# , so my doubt is how can i bind datagridview to dataset . actually i finishes wrote code , but when i trace it ..data getting into datasource but its not displaying into datagridview ..let me Know is there any i can change into datagridview property . Please if u know scarp me. Thanks Raj

    Some Thing need 2 do NEW

    V 1 Reply Last reply
    0
    • R Rajeshwar Code Developer

      Hi Every one, now i m using window forms using C# , so my doubt is how can i bind datagridview to dataset . actually i finishes wrote code , but when i trace it ..data getting into datasource but its not displaying into datagridview ..let me Know is there any i can change into datagridview property . Please if u know scarp me. Thanks Raj

      Some Thing need 2 do NEW

      V Offline
      V Offline
      Vimalsoft Pty Ltd
      wrote on last edited by
      #2

      We cant know why? because we don't see the code.

      Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.somee.com http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

      R 1 Reply Last reply
      0
      • V Vimalsoft Pty Ltd

        We cant know why? because we don't see the code.

        Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.somee.com http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

        R Offline
        R Offline
        Rajeshwar Code Developer
        wrote on last edited by
        #3

        Thanks for reply bro.. I need the answers bro..i thnik its not answer..

        Some Thing need 2 do NEW

        V K 2 Replies Last reply
        0
        • R Rajeshwar Code Developer

          Thanks for reply bro.. I need the answers bro..i thnik its not answer..

          Some Thing need 2 do NEW

          V Offline
          V Offline
          Vimalsoft Pty Ltd
          wrote on last edited by
          #4

          We cannot Help until we see the code where you bind the Grid

          Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.somee.com http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

          R 1 Reply Last reply
          0
          • R Rajeshwar Code Developer

            Thanks for reply bro.. I need the answers bro..i thnik its not answer..

            Some Thing need 2 do NEW

            K Offline
            K Offline
            K0306
            wrote on last edited by
            #5

            Try this sample code

                        SqlCommand cmd = new SqlCommand();
                        cmd.Connection = sqlConnection();
                        cmd.CommandText ="your query";
                        SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                        DataSet ds = new DataSet();
                        adapter.Fill(ds);
                        datagridview1.DataSource = ds;
            

            Regards, Karthik K...

            1 Reply Last reply
            0
            • V Vimalsoft Pty Ltd

              We cannot Help until we see the code where you bind the Grid

              Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.somee.com http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

              R Offline
              R Offline
              Rajeshwar Code Developer
              wrote on last edited by
              #6

              Ok bro .. this is my code once through it let me know where i did mistake. SqlConnection cn = new SqlConnection("server=.;uid=sa;pwd=sa;database=Payroll1"); string ssql = "Select * from EmpDetails"; SqlDataAdapter da = new SqlDataAdapter(ssql, cn); DataSet ds = new DataSet(); da.Fill(ds); BindingSource bindgrd = new BindingSource(); bindgrd.DataSource = ds; this.Datagridview1.DataSource = bindgrd;

              Some Thing need 2 do NEW

              V 1 Reply Last reply
              0
              • R Rajeshwar Code Developer

                Ok bro .. this is my code once through it let me know where i did mistake. SqlConnection cn = new SqlConnection("server=.;uid=sa;pwd=sa;database=Payroll1"); string ssql = "Select * from EmpDetails"; SqlDataAdapter da = new SqlDataAdapter(ssql, cn); DataSet ds = new DataSet(); da.Fill(ds); BindingSource bindgrd = new BindingSource(); bindgrd.DataSource = ds; this.Datagridview1.DataSource = bindgrd;

                Some Thing need 2 do NEW

                V Offline
                V Offline
                Vimalsoft Pty Ltd
                wrote on last edited by
                #7

                Good Day Rajeshwar I dont use Wizards to do my database. can you do a Check for me. put your code in a try and check if there are any rows returned

                SqlConnection cn = new SqlConnection("server=.;uid=sa;pwd=sa;database=Payroll1");
                string ssql = "Select * from EmpDetails";
                SqlDataAdapter da = new SqlDataAdapter(ssql, cn);
                DataSet ds = new DataSet();

                try
                {
                cn.open();
                da.Fill(ds);
                BindingSource bindgrd = new BindingSource();
                bindgrd.DataSource = ds;

                if(ds.Tables[0].Rows.count > 0)
                {
                this.Datagridview1.DataSource = bindgrd;
                }
                else
                {
                lblError.text = "No Rows Returned";
                }
                catch(SQlException ex)
                {
                lblError.text = ex.Message;
                }
                Finaly
                {
                cn.close();
                }

                Tell me if you get an Error or there are any Rows Returned. I wrote this here, so the logic is correct , just correct the syntax dont do copy and paste and tell me what it does.

                Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.somee.com http://www.vuyiswamaseko.tiyaneProperties.co.za vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

                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