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
I have a table and I want to get specific column from my dataset my table only has one row.
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
add a comment |
I have a table and I want to get specific column from my dataset my table only has one row.
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
From where do you expect to callgetDataCellString
?
– JayV
Mar 8 at 15:43
I expect to call getDataCellString from a aspx.cs file.
– Junior Cortenbach
Mar 8 at 15:45
add a comment |
I have a table and I want to get specific column from my dataset my table only has one row.
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
I have a table and I want to get specific column from my dataset my table only has one row.
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
c# asp.net header dataset cell
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 callgetDataCellString
?
– JayV
Mar 8 at 15:43
I expect to call getDataCellString from a aspx.cs file.
– Junior Cortenbach
Mar 8 at 15:45
add a comment |
From where do you expect to callgetDataCellString
?
– 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
add a comment |
2 Answers
2
active
oldest
votes
If you only have one row you can:
public string getDataCellString(string headerName)
return Ds.Tables[0].Rows[0][headerName].ToString();
add a comment |
`Ds.Tables[0].Rows[0]["headerName"].ToString();
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
If you only have one row you can:
public string getDataCellString(string headerName)
return Ds.Tables[0].Rows[0][headerName].ToString();
add a comment |
If you only have one row you can:
public string getDataCellString(string headerName)
return Ds.Tables[0].Rows[0][headerName].ToString();
add a comment |
If you only have one row you can:
public string getDataCellString(string headerName)
return Ds.Tables[0].Rows[0][headerName].ToString();
If you only have one row you can:
public string getDataCellString(string headerName)
return Ds.Tables[0].Rows[0][headerName].ToString();
edited Mar 8 at 15:51
Junior Cortenbach
9212
9212
answered Mar 8 at 15:44
tezzotezzo
8,06911440
8,06911440
add a comment |
add a comment |
`Ds.Tables[0].Rows[0]["headerName"].ToString();
add a comment |
`Ds.Tables[0].Rows[0]["headerName"].ToString();
add a comment |
`Ds.Tables[0].Rows[0]["headerName"].ToString();
`Ds.Tables[0].Rows[0]["headerName"].ToString();
edited Mar 9 at 1:50
Junior Cortenbach
9212
9212
answered Mar 8 at 15:45
Georges KhaterGeorges Khater
662
662
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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