473,406 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

how to retrieve value stored in dataset?

hi all,

i have image path name in database and i am fetching it this way.
Expand|Select|Wrap|Line Numbers
  1. con.Open();
  2. string img= "select imgPath from Tbl_Image where imgId='1'";
  3. SqlCommand cmd = new SqlCommand(img,con);
  4. SqlDataAdapter da = new SqlDataAdapter(cmd);
  5. DataSet ds = new DataSet();
  6. da.Fill(ds);
  7. con.Close();
i got path name in ds.

now my question is how to assign that path to my image.

//imgCurrent.ImageUrl

Thanks you,
krunalkakadia
Feb 25 '11 #1
2 3091
Frinavale
9,735 Expert Mod 8TB
Your DataSet contains a set of DataTables that contain the data that you requested from the database. In your case it looks like the result of your query is 1 table with 1 record/row in it.

You need to use the DataSet.Tables Property to retrieve the table. Then you need to retrieve the item you are interested in from the row/column in the table.

-Frinny
Feb 28 '11 #2
dip_developer
648 Expert 512MB
imgCurrent.ImageUrl=ds.Tables(0).Rows(0).Item("img Path")
Mar 1 '11 #3

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

Similar topics

4
by: Jerry Orr | last post by:
I am attempting to retrieve various MVS dataset allocation parameters (lrecl, block size, etc) from a C/C++ program. The C/C++ Run-time Library Reference states that the function svc99() can be...
1
by: Boltar | last post by:
Hello, I am relatively new to C#. There is a particular address in memory on my computer that stores a string value. The address is 57E777. Does anyone know how I can retrieve the string...
1
by: Kevin C | last post by:
Is the IsPostBack property value stored in viewstate?
12
by: Dica | last post by:
i can't seem to find a way to cast the value in my comboBox to integer. i've tried the following: short iProjectID = Convert.ToInt16(cboProjects.SelectedValue); i keep getting a "Sepcified...
2
by: DeWitt Phillips | last post by:
First let me say thank you. I am trying to extract the last value entered into a database column without having to read through every value stored in the column. Is that something that is easy to...
7
by: Peter | last post by:
Gday, I have a dataset with multiple tables, from which I want to access a single value in one of those tables. I know I can do something like: Decimal myVar =...
2
by: rajrajnew | last post by:
Hi, I developed web usercontrol, which populates all countries data. I want to retrieve value from it and place it on a label with out using button click event. I mean that it should act like...
5
by: hameeduddinasim | last post by:
Hi I am trying to take a particular value from dataset in to string kindly look at my code string image_url = dt.Rows.Table.Columns.ToString(); with the above code I am getting...
9
by: Vbbeginner07 | last post by:
Want to change the value stored in the bold, it's a code to calculate the payroll. If txttr.Text = "" Then Form2.txttamt.Text = "" MsgBox "enter the tax rate", vbOKOnly, "ERROR" ...
4
by: Bikash Kumar Mishra | last post by:
how to access the bits of a value stored in memory as such?
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.