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. get row values on datagrid

get row values on datagrid

Scheduled Pinned Locked Moved C#
databasesecurity
4 Posts 2 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.
  • M Offline
    M Offline
    mrx100
    wrote on last edited by
    #1

    hi all , i use this code to fill datagrid with data from my database

    private void btn_by_Click(object sender, EventArgs e)
    {

    DataTable dt = new DataTable(); SqlConnection con = new SqlConnection("Data Source=MS-TOSHIBA;Initial Catalog=dalily system;Integrated Security=True"); SqlCommand cmd = new SqlCommand("select place.name,place.address,place.telephone,place.website,place.email,place.info from place,subcateogry where place.subcat_id=subcateogry.id And subcateogry.name='" + subcat_comboBox.SelectedItem.ToString() + "' ", con); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); dt.Load(dr); dataGridView1.DataSource = dt; dr.Close(); con.Close(); } now i want when i click on row select coordinate_x & coordinate_y from place table where name is in row i clicked on And store coordinate_x & coordinate_y as double thanks in advance

    D 1 Reply Last reply
    0
    • M mrx100

      hi all , i use this code to fill datagrid with data from my database

      private void btn_by_Click(object sender, EventArgs e)
      {

      DataTable dt = new DataTable(); SqlConnection con = new SqlConnection("Data Source=MS-TOSHIBA;Initial Catalog=dalily system;Integrated Security=True"); SqlCommand cmd = new SqlCommand("select place.name,place.address,place.telephone,place.website,place.email,place.info from place,subcateogry where place.subcat_id=subcateogry.id And subcateogry.name='" + subcat_comboBox.SelectedItem.ToString() + "' ", con); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); dt.Load(dr); dataGridView1.DataSource = dt; dr.Close(); con.Close(); } now i want when i click on row select coordinate_x & coordinate_y from place table where name is in row i clicked on And store coordinate_x & coordinate_y as double thanks in advance

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Just stop posting the same question twice in a row. There's no need and you're not drawing any more attention to your question. You're drawing it to yourself and not in a good light either.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak

      M 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Just stop posting the same question twice in a row. There's no need and you're not drawing any more attention to your question. You're drawing it to yourself and not in a good light either.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak

        M Offline
        M Offline
        mrx100
        wrote on last edited by
        #3

        i don't want to do that but there is a problem with my browser so when i click post nothing happen so i think my question not posted :)

        D 1 Reply Last reply
        0
        • M mrx100

          i don't want to do that but there is a problem with my browser so when i click post nothing happen so i think my question not posted :)

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Then you can check to see if it has been posted before doing it again.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak

          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