473,508 Members | 2,374 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Retreving a value from dataset into string

13 New Member
Hi

I am trying to take a particular value from dataset in to string

kindly look at my code

string image_url = dt.Rows[0].Table.Columns[0].ToString();

with the above code I am getting Column name in the string but i need the value of that perticular column

Note :- Dataset return only a single row ,there r no multiple row

Kindly help me in this regrad

Thanks
Aug 15 '07 #1
5 1336
hameeduddinasim
13 New Member
sorry i cant hPlease follow these guidelines when responding to questions.
Provide relevant answers and solutions
Write in clear concise language using correct grammar and spelling
Use CODE tags around your code:
Expand|Select|Wrap|Line Numbers
  1. ..code goes here..
Do not link to other websites for promoting/traffic generation. Only link to helpful resources.
elp u
Aug 15 '07 #2
RoninZA
78 New Member
Expand|Select|Wrap|Line Numbers
  1. string image_url = dt.Rows[0][0].ToString();
  2.  
Aug 15 '07 #3
hameeduddinasim
13 New Member
Expand|Select|Wrap|Line Numbers
  1. string image_url = dt.Rows[0][0].ToString();
  2.  

Thanks Man it resolve my issue
Aug 15 '07 #4
echuck66
3 New Member
Hi

I am trying to take a particular value from dataset in to string

kindly look at my code

string image_url = dt.Rows[0].Table.Columns[0].ToString();

with the above code I am getting Column name in the string but i need the value of that perticular column

Note :- Dataset return only a single row ,there r no multiple row

Kindly help me in this regrad

Thanks
If dt represents a data table, then you should assign a row index variable (rowIdx) and use it to retrieve your data:

dt.Rows[rowIdx][0].ToString();

Charlie
Aug 15 '07 #5
RoninZA
78 New Member
Thanks Man it resolve my issue
This works, because you're referencing column 0 of row 0, instead of going up a level by referencing the column of the table the row belongs to.

Glad to have helped :)
Aug 20 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
7442
by: DraguVaso | last post by:
Hi, Something I don't understand about a Typed DataSet: When a value in the DataSet is DBNull, it throws this error: "Cannot get value because it is DBNull". But aren't Typed DataSets...
2
26595
by: Andreas Palm | last post by:
I have a dataset that has DBNull in certain columns, now when I write out this one to XML, I only get the columns as elements that do have data in it. However I do need also the empty colums as...
1
15731
by: Amadelle | last post by:
Hi all and thanks in advance for your help, I have a problem with capturing the changed value of a text box in a datagrid. The datagrid is populated based on a dataset and I am using template...
2
1119
by: Amit Pandya | last post by:
Hi This is all using C# and i am new to it. I have a checkbox control that is added programmtically in the page_load event. Now on button click i want to retreive the checkbox control but i...
1
1855
by: Amadelle | last post by:
Hi all and thanks in advance for your help, I have a problem with capturing the changed value of a text box in a datagrid. The datagrid is populated based on a dataset and I am using template...
9
8489
by: Capt_Ron | last post by:
Hello, I would like to set the value of the item in the checked list box. I have a datareader that has 2 columns. PK and TEXT I want the TEXT as the Item and the PK as the Value. I can not...
2
1914
by: eBob.com | last post by:
I've got the basics of an XML ini file working. I.E. I can stash away and retrieve user preferences. (Code below.) But how do I handle a new preference? Say I have A and B. And then I invent...
13
10087
by: dbuchanan | last post by:
Hello, Here is the error message; ---------------------------- Exception Message: ForeignKeyConstraint Lkp_tbl040Cmpt_lkp302SensorType requires the child key values (5) to exist in the...
5
2349
by: codefragment | last post by:
Hi I have a dataset which holds (amongest other things) a string. - The dataset gets loaded from the database via a middle tier - The string value contains "\r\n" - Its serialised to the web...
0
7120
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1553
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.