Manipulate the data returned from database query

Last post 05-08-2008 10:56 AM by kamii47. 3 replies.

Sort Posts:

  • Manipulate the data returned from database query

    05-08-2008, 8:42 AM
    • Member
      point Member
    • asp.newtome
    • Member since 04-23-2008, 4:43 PM
    • Posts 5

    Hi,

    I am new to APS.NET and programming in general and was looking for some help.  I am using ASP.NET 2.0 and C# with an Oracle 10g Express Edition database behind my application.

    What I am trying to do is retrieve the last 10 entries in the database (I know the SQL to do this) but would like some help on how best to fire the query i.e. would it be ExecuteNonQuery or something different? 

    Once I have retrieved the 10 rows of data I want to be able to manipulate certain columns within those different rows, the way I thought I would do this would be to somehow get the data returned from database query into an array? but I do not know how to do this!

    Could anyone please give me some advise on how best to proceed in this matter or point me in the direction of some good websites?

    Any help would be gratefully received,

    Regards

  • Re: Manipulate the data returned from database query

    05-08-2008, 9:09 AM
    • Star
      9,460 point Star
    • kamii47
    • Member since 05-26-2005, 4:04 PM
    • Karachi, Pakistan
    • Posts 2,192
    Kamran Shahid
    Sr. Software Engineer
    (MCP,MCAD.net,MCSD.net,MCTS,MCPD.net[web])

    Remember to click "Mark as Answer" on the post that helps U
  • Re: Manipulate the data returned from database query

    05-08-2008, 10:20 AM
    • Member
      point Member
    • asp.newtome
    • Member since 04-23-2008, 4:43 PM
    • Posts 5

    Thank you Kamran for your quick response.

    The example in the website you referenced is as follows, once the data is in the dataset the following line of code is executed:

     cboEmpName.DisplayMember = empDataSet.Tables["emp"].Columns["ename"].ToString();

    which from what I can gather, is setting the combo box to list all the values in the ename column of the emp table?  However what I do not under is how I would access a single cell in the column instead of the all values in the column.

    Again any help would be gratefully received.

    Regards

     

  • Re: Manipulate the data returned from database query

    05-08-2008, 10:56 AM
    • Star
      9,460 point Star
    • kamii47
    • Member since 05-26-2005, 4:04 PM
    • Karachi, Pakistan
    • Posts 2,192

    For that you have loop through the element

    for (int i =0;i< empDataSet.Tables["emp"].Rows.Count;i++

    {

     sring str = empDataSet.Tables[i]["emp"].ToString();

     

    .. 

    Kamran Shahid
    Sr. Software Engineer
    (MCP,MCAD.net,MCSD.net,MCTS,MCPD.net[web])

    Remember to click "Mark as Answer" on the post that helps U
Page 1 of 1 (4 items)