Retrieve Data from a dataset

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2004
Posts: 11
Reputation: Tellie is an unknown quantity at this point 
Solved Threads: 0
Tellie Tellie is offline Offline
Newbie Poster

Retrieve Data from a dataset

 
0
  #1
Apr 27th, 2004
Hi All

I have created a dataset and from this I want to retrieve values of a column into a variable. How can I do this?

This is the code:

Dim sQuery AsString = "Select PERMISSION_BUTTON_ID from ALC_SECURITY_PERMISSION where ROLE_ID = 1"

Response.Write(sQuery)

Dim myAdapter As OleDbDataAdapter = New OleDbDataAdapter(sQuery, connectionString)

Dim mySet As DataSet = New DataSet

myAdapter.Fill(mySet, "ALC_SECURITY_PERMISSION")

From the above code I need to retrieve all the values of PERMISSION_BUTTON_ID retrieved from the Select statement inot a variable.

Please help
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 11
Reputation: Tellie is an unknown quantity at this point 
Solved Threads: 0
Tellie Tellie is offline Offline
Newbie Poster

Re: Retrieve Data from a dataset

 
1
  #2
Apr 27th, 2004
Ok now what I have done to this is:

Dim sQuery AsString = "Select PERMISSION_BUTTON_ID from ALC_SECURITY_PERMISSION where ROLE_ID = 1"

'Response.Write(sQuery)

Dim myAdapter As OleDbDataAdapter = New OleDbDataAdapter(sQuery, connectionString)

Dim mySet As DataSet = New DataSet

myAdapter.Fill(mySet, "ALC_SECURITY_PERMISSION")

Dim permID AsString

permID = mySet.GetXml.ToString()

But now I am not sure how to retrieve values from this?

Is this a correct approach?
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 27
Reputation: srikkanthan is on a distinguished road 
Solved Threads: 0
srikkanthan srikkanthan is offline Offline
Light Poster

Re: Retrieve Data from a dataset

 
0
  #3
May 10th, 2004
I am not sure what exactly you want to do... Obviously by looping through
mySet.Tables(0).Rows(i)("PERMISSION_BUTTON_ID") you can get all button ids... right?!
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1
Reputation: injunraiv is an unknown quantity at this point 
Solved Threads: 0
injunraiv injunraiv is offline Offline
Newbie Poster

Re: Retrieve Data from a dataset

 
0
  #4
Oct 18th, 2007
I'm not sure this will help, as I'm a beginner at this language myself, but here's code I figured out last night for my program...

  1. da.Fill(EmployeeData)
  2. OleDbConnection1.Close()
  3.  
  4. Dim row As Data.DataRow
  5. Dim count As Integer = EmployeeData.Rows.Count
  6. Dim i As Integer = 0
  7.  
  8. For i = 0 To count - 1
  9. 'vSeq = EmployeeData.Rows(i).Item("Seq")

What we're doing in this snippet is filling my 'EmployeeData' dataset, setting up a counter to loop through all the records, and putting the value of the column "Seq" into my vSeq variable.

Hope this helped...
Last edited by injunraiv; Oct 18th, 2007 at 10:28 am.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 13
Reputation: chan_lemo is an unknown quantity at this point 
Solved Threads: 1
chan_lemo chan_lemo is offline Offline
Newbie Poster

Re: Retrieve Data from a dataset

 
0
  #5
Oct 16th, 2008
For i = 0 To mySet.Tables(0).Rows.Count - 1
PERMISSION_BUTTON_ID = ds.Tables(0).Rows(i).Item(0)
Next

also you can do it in so many other ways . go throught the follwoing link.

http://vb.net-informations.com/datas...t-tutorial.htm

lemo.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 4
Reputation: Gayan Wijeratne is an unknown quantity at this point 
Solved Threads: 0
Gayan Wijeratne Gayan Wijeratne is offline Offline
Newbie Poster

Re: Retrieve Data from a dataset

 
0
  #6
Nov 27th, 2008
Originally Posted by Tellie View Post
Hi All

I have created a dataset and from this I want to retrieve values of a column into a variable. How can I do this?

This is the code:

Dim sQuery As String = "Select PERMISSION_BUTTON_ID from ALC_SECURITY_PERMISSION where ROLE_ID = 1"

Response.Write(sQuery)

Dim myAdapter As OleDbDataAdapter = New OleDbDataAdapter(sQuery, connectionString)

Dim mySet As DataSet = New DataSet

myAdapter.Fill(mySet, "ALC_SECURITY_PERMISSION")

From the above code I need to retrieve all the values of PERMISSION_BUTTON_ID retrieved from the Select statement inot a variable.

Please help

suppose your dataset is -ds

you can see your data

msgbox(ds.Tables(0).rows(0).itemarray(0))

this is the first row / first column data

but you shuld have a atleast one row in the data set.

Other wise it should check with


if ds.tables(0).rows.count > 0 ...................
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 16
Reputation: Rogachev is an unknown quantity at this point 
Solved Threads: 2
Rogachev Rogachev is offline Offline
Newbie Poster

Re: Retrieve Data from a dataset

 
0
  #7
Nov 28th, 2008
Hi,

Maybe this code can help you.

for each _row as DataRow in mySet.Tables("ALC_SECURITY_PERMISSION").Rows
msgbox( _row.Item("PERMISSION_BUTTON_ID").ToString())
Next
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC