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

                      Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

                      Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

                      How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page