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. click on dtagridview display result in relative textbox

click on dtagridview display result in relative textbox

Scheduled Pinned Locked Moved C#
security
7 Posts 4 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.
  • J Offline
    J Offline
    jadhavShubhangi
    wrote on last edited by
    #1

    hi........ the code is con.ConnectionString = "Data Source=SPARK1\\SQLEXPRESS;Initial Catalog=Empdetails;Integrated security=true"; con.Open(); //int p = Convert.ToInt32(dataGridView1.SelectedRows); String s = "Select * from Empdetails where EmpId="; SqlCommand cmd = new SqlCommand(s, con); SqlDataReader dr = cmd.ExecuteReader(); //dataGridView1.DataSource = dr; //GridView1.DataBind(); while (dr.Read()) { txtempid.Text = dr.GetInt32(0).ToString(); txtname.Text = dr.GetValue(1).ToString(); txtaddress.Text = dr.GetValue(2).ToString(); combodes.Text = dr.GetValue(3).ToString(); txtphno.Text = dr.GetInt32(4).ToString(); } dr.Close(); cmd.ExecuteNonQuery(); con.Close(); }

    K 1 Reply Last reply
    0
    • J jadhavShubhangi

      hi........ the code is con.ConnectionString = "Data Source=SPARK1\\SQLEXPRESS;Initial Catalog=Empdetails;Integrated security=true"; con.Open(); //int p = Convert.ToInt32(dataGridView1.SelectedRows); String s = "Select * from Empdetails where EmpId="; SqlCommand cmd = new SqlCommand(s, con); SqlDataReader dr = cmd.ExecuteReader(); //dataGridView1.DataSource = dr; //GridView1.DataBind(); while (dr.Read()) { txtempid.Text = dr.GetInt32(0).ToString(); txtname.Text = dr.GetValue(1).ToString(); txtaddress.Text = dr.GetValue(2).ToString(); combodes.Text = dr.GetValue(3).ToString(); txtphno.Text = dr.GetInt32(4).ToString(); } dr.Close(); cmd.ExecuteNonQuery(); con.Close(); }

      K Offline
      K Offline
      Keith Barrow
      wrote on last edited by
      #2

      a) You've posted code, but not formatted it. in <pre> tags b) You haven't said what is or is not happening that needs to be fixed.

      Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.

      J OriginalGriffO 2 Replies Last reply
      0
      • K Keith Barrow

        a) You've posted code, but not formatted it. in <pre> tags b) You haven't said what is or is not happening that needs to be fixed.

        Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.

        OriginalGriffO Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #3

        :thumbsup:

        You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        1 Reply Last reply
        0
        • K Keith Barrow

          a) You've posted code, but not formatted it. in <pre> tags b) You haven't said what is or is not happening that needs to be fixed.

          Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.

          J Offline
          J Offline
          jadhavShubhangi
          wrote on last edited by
          #4

          hi......... the code is con.ConnectionString = "Data Source=SPARK1\\SQLEXPRESS;Initial Catalog=Empdetails;Integrated security=true"; con.Open(); //int p = Convert.ToInt32(dataGridView1.SelectedRows); String s = "Select * from Empdetails where EmpId="; SqlCommand cmd = new SqlCommand(s, con); SqlDataReader dr = cmd.ExecuteReader(); //dataGridView1.DataSource = dr; //GridView1.DataBind(); while (dr.Read()) { txtempid.Text = dr.GetInt32(0).ToString(); txtname.Text = dr.GetValue(1).ToString(); txtaddress.Text = dr.GetValue(2).ToString(); combodes.Text = dr.GetValue(3).ToString(); txtphno.Text = dr.GetInt32(4).ToString(); } dr.Close(); cmd.ExecuteNonQuery(); con.Close();

          OriginalGriffO L 2 Replies Last reply
          0
          • J jadhavShubhangi

            hi......... the code is con.ConnectionString = "Data Source=SPARK1\\SQLEXPRESS;Initial Catalog=Empdetails;Integrated security=true"; con.Open(); //int p = Convert.ToInt32(dataGridView1.SelectedRows); String s = "Select * from Empdetails where EmpId="; SqlCommand cmd = new SqlCommand(s, con); SqlDataReader dr = cmd.ExecuteReader(); //dataGridView1.DataSource = dr; //GridView1.DataBind(); while (dr.Read()) { txtempid.Text = dr.GetInt32(0).ToString(); txtname.Text = dr.GetValue(1).ToString(); txtaddress.Text = dr.GetValue(2).ToString(); combodes.Text = dr.GetValue(3).ToString(); txtphno.Text = dr.GetInt32(4).ToString(); } dr.Close(); cmd.ExecuteNonQuery(); con.Close();

            OriginalGriffO Offline
            OriginalGriffO Offline
            OriginalGriff
            wrote on last edited by
            #5

            Congratulations! You win the prize for posting the most useless post of the day! Exactly the same as the post you were criticised for, but missing one closing curly bracket! Well done - and thanks for listening! :-D

            You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
            "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

            1 Reply Last reply
            0
            • J jadhavShubhangi

              hi......... the code is con.ConnectionString = "Data Source=SPARK1\\SQLEXPRESS;Initial Catalog=Empdetails;Integrated security=true"; con.Open(); //int p = Convert.ToInt32(dataGridView1.SelectedRows); String s = "Select * from Empdetails where EmpId="; SqlCommand cmd = new SqlCommand(s, con); SqlDataReader dr = cmd.ExecuteReader(); //dataGridView1.DataSource = dr; //GridView1.DataBind(); while (dr.Read()) { txtempid.Text = dr.GetInt32(0).ToString(); txtname.Text = dr.GetValue(1).ToString(); txtaddress.Text = dr.GetValue(2).ToString(); combodes.Text = dr.GetValue(3).ToString(); txtphno.Text = dr.GetInt32(4).ToString(); } dr.Close(); cmd.ExecuteNonQuery(); con.Close();

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              you may not be the smartest guy in town, but at least you are consistent. :omg:

              Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


              I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.


              OriginalGriffO 1 Reply Last reply
              0
              • L Luc Pattyn

                you may not be the smartest guy in town, but at least you are consistent. :omg:

                Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.


                OriginalGriffO Offline
                OriginalGriffO Offline
                OriginalGriff
                wrote on last edited by
                #7

                "A foolish consistency is the hobgoblin of little minds" - R W Emerson. I think it applies quite well to this questioner. Judging by his other posts, he is trying to punch well above his programming weight...

                You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy

                "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                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