User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 427,123 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,029 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 26962 | Replies: 3
Reply
Join Date: Apr 2004
Posts: 11
Reputation: Tellie is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Tellie Tellie is offline Offline
Newbie Poster

Retrieve Data from a dataset

  #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 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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2004
Posts: 11
Reputation: Tellie is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Tellie Tellie is offline Offline
Newbie Poster

Re: Retrieve Data from a dataset

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

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")

Dim permID As String

permID = mySet.GetXml.ToString()

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

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

Re: Retrieve Data from a dataset

  #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  
Join Date: Oct 2007
Posts: 1
Reputation: injunraiv is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
injunraiv injunraiv is offline Offline
Newbie Poster

Re: Retrieve Data from a dataset

  #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...

                da.Fill(EmployeeData)
                OleDbConnection1.Close()

                Dim row As Data.DataRow
                Dim count As Integer = EmployeeData.Rows.Count
                Dim i As Integer = 0

                For i = 0 To count - 1
                    '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 9:28 am.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb VB.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the VB.NET Forum

All times are GMT -4. The time now is 6:28 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC