how can I get a cell value from a header name in a dataset with one row The Next CEO of Stack OverflowHow can I get the application's path in a .NET console application?How can I get the assembly file versionGet int value from enum in C#Get property value from string using reflection in C#c# closing sqlconnection and sqldatareader or not?Sorting dataset in asp.net c#Multiple dropdowns from different databases on a single view in asp.net mvc4DataSet using first value as column headerHow can I get the value of a specific excel cell in asp.net in a string or integer?Fill Dataset Async

Is wanting to ask what to write an indication that you need to change your story?

How to get from Geneva Airport to Metabief?

0 rank tensor vs 1D vector

Is there a difference between "Fahrstuhl" and "Aufzug"

What did we know about the Kessel run before the prequels?

Where does this common spurious transmission come from? Is there a quality difference?

How to count occurrences of text in a file?

Find non-case sensitive string in a mixed list of elements?

Are police here, aren't itthey?

Is there a way to save my career from absolute disaster?

A Man With a Stainless Steel Endoskeleton (like The Terminator) Fighting Cloaked Aliens Only He Can See

Some questions about different axiomatic systems for neighbourhoods

Why do airplanes bank sharply to the right after air-to-air refueling?

How to avoid supervisors with prejudiced views?

Why doesn't UK go for the same deal Japan has with EU to resolve Brexit?

The exact meaning of 'Mom made me a sandwich'

Where do students learn to solve polynomial equations these days?

Why did CATV standarize in 75 ohms and everyone else in 50?

What happened in Rome, when the western empire "fell"?

Help understanding this unsettling image of Titan, Epimetheus, and Saturn's rings?

Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?

Proper way to express "He disappeared them"

Why is information "lost" when it got into a black hole?

Reference request: Grassmannian and Plucker coordinates in type B, C, D



how can I get a cell value from a header name in a dataset with one row



The Next CEO of Stack OverflowHow can I get the application's path in a .NET console application?How can I get the assembly file versionGet int value from enum in C#Get property value from string using reflection in C#c# closing sqlconnection and sqldatareader or not?Sorting dataset in asp.net c#Multiple dropdowns from different databases on a single view in asp.net mvc4DataSet using first value as column headerHow can I get the value of a specific excel cell in asp.net in a string or integer?Fill Dataset Async










0















I have a table and I want to get specific column from my dataset my table only has one row.



Here is a image of what my table



Here is my code



private DataSet Ds = new DataSet();

public DataSet GetDataSet(string Query)

try

using (MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection(connString))

MySqlDataAdapter Da = new MySqlDataAdapter(Query, conn);
Da.Fill(Ds);
conn.Close();


catch (Exception)
return Ds; //See image


public string getDataCellString(string headerName)

return "";//I want to get cell from heder name



Here is my question: How can I get a cell value from a header name?










share|improve this question
























  • From where do you expect to call getDataCellString ?

    – JayV
    Mar 8 at 15:43











  • I expect to call getDataCellString from a aspx.cs file.

    – Junior Cortenbach
    Mar 8 at 15:45















0















I have a table and I want to get specific column from my dataset my table only has one row.



Here is a image of what my table



Here is my code



private DataSet Ds = new DataSet();

public DataSet GetDataSet(string Query)

try

using (MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection(connString))

MySqlDataAdapter Da = new MySqlDataAdapter(Query, conn);
Da.Fill(Ds);
conn.Close();


catch (Exception)
return Ds; //See image


public string getDataCellString(string headerName)

return "";//I want to get cell from heder name



Here is my question: How can I get a cell value from a header name?










share|improve this question
























  • From where do you expect to call getDataCellString ?

    – JayV
    Mar 8 at 15:43











  • I expect to call getDataCellString from a aspx.cs file.

    – Junior Cortenbach
    Mar 8 at 15:45













0












0








0








I have a table and I want to get specific column from my dataset my table only has one row.



Here is a image of what my table



Here is my code



private DataSet Ds = new DataSet();

public DataSet GetDataSet(string Query)

try

using (MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection(connString))

MySqlDataAdapter Da = new MySqlDataAdapter(Query, conn);
Da.Fill(Ds);
conn.Close();


catch (Exception)
return Ds; //See image


public string getDataCellString(string headerName)

return "";//I want to get cell from heder name



Here is my question: How can I get a cell value from a header name?










share|improve this question
















I have a table and I want to get specific column from my dataset my table only has one row.



Here is a image of what my table



Here is my code



private DataSet Ds = new DataSet();

public DataSet GetDataSet(string Query)

try

using (MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection(connString))

MySqlDataAdapter Da = new MySqlDataAdapter(Query, conn);
Da.Fill(Ds);
conn.Close();


catch (Exception)
return Ds; //See image


public string getDataCellString(string headerName)

return "";//I want to get cell from heder name



Here is my question: How can I get a cell value from a header name?







c# asp.net header dataset cell






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 8 at 15:40









user3382203

481320




481320










asked Mar 8 at 15:38









Junior CortenbachJunior Cortenbach

9212




9212












  • From where do you expect to call getDataCellString ?

    – JayV
    Mar 8 at 15:43











  • I expect to call getDataCellString from a aspx.cs file.

    – Junior Cortenbach
    Mar 8 at 15:45

















  • From where do you expect to call getDataCellString ?

    – JayV
    Mar 8 at 15:43











  • I expect to call getDataCellString from a aspx.cs file.

    – Junior Cortenbach
    Mar 8 at 15:45
















From where do you expect to call getDataCellString ?

– JayV
Mar 8 at 15:43





From where do you expect to call getDataCellString ?

– JayV
Mar 8 at 15:43













I expect to call getDataCellString from a aspx.cs file.

– Junior Cortenbach
Mar 8 at 15:45





I expect to call getDataCellString from a aspx.cs file.

– Junior Cortenbach
Mar 8 at 15:45












2 Answers
2






active

oldest

votes


















1














If you only have one row you can:



public string getDataCellString(string headerName)

return Ds.Tables[0].Rows[0][headerName].ToString();






share|improve this answer
































    1














    `Ds.Tables[0].Rows[0]["headerName"].ToString();






    share|improve this answer

























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55066477%2fhow-can-i-get-a-cell-value-from-a-header-name-in-a-dataset-with-one-row%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      If you only have one row you can:



      public string getDataCellString(string headerName)

      return Ds.Tables[0].Rows[0][headerName].ToString();






      share|improve this answer





























        1














        If you only have one row you can:



        public string getDataCellString(string headerName)

        return Ds.Tables[0].Rows[0][headerName].ToString();






        share|improve this answer



























          1












          1








          1







          If you only have one row you can:



          public string getDataCellString(string headerName)

          return Ds.Tables[0].Rows[0][headerName].ToString();






          share|improve this answer















          If you only have one row you can:



          public string getDataCellString(string headerName)

          return Ds.Tables[0].Rows[0][headerName].ToString();







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 8 at 15:51









          Junior Cortenbach

          9212




          9212










          answered Mar 8 at 15:44









          tezzotezzo

          8,06911440




          8,06911440























              1














              `Ds.Tables[0].Rows[0]["headerName"].ToString();






              share|improve this answer





























                1














                `Ds.Tables[0].Rows[0]["headerName"].ToString();






                share|improve this answer



























                  1












                  1








                  1







                  `Ds.Tables[0].Rows[0]["headerName"].ToString();






                  share|improve this answer















                  `Ds.Tables[0].Rows[0]["headerName"].ToString();







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 9 at 1:50









                  Junior Cortenbach

                  9212




                  9212










                  answered Mar 8 at 15:45









                  Georges KhaterGeorges Khater

                  662




                  662



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55066477%2fhow-can-i-get-a-cell-value-from-a-header-name-in-a-dataset-with-one-row%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

                      Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

                      2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived