| | |
Retrieve Data from a dataset
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2004
Posts: 11
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Apr 2004
Posts: 11
Reputation:
Solved Threads: 0
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?
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?
•
•
Join Date: Oct 2007
Posts: 1
Reputation:
Solved Threads: 0
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...
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...
VB.NET Syntax (Toggle Plain Text)
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 10:28 am.
•
•
Join Date: Oct 2008
Posts: 13
Reputation:
Solved Threads: 1
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.
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.
•
•
Join Date: Nov 2008
Posts: 4
Reputation:
Solved Threads: 0
•
•
•
•
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 ...................
![]() |
Similar Threads
- retrieve data from database into jsp(urgent)!!! (Oracle)
- How to retrieve data from a dynamically generated radio button (ASP.NET)
- 1 .Exporting data from Dataset to XLl sheet in VB.net Windows Application &vice versa (VB.NET)
- retrieve data by VB.Net (VB.NET)
Other Threads in the VB.NET Forum
- Previous Thread: Updating combobox with items
- Next Thread: PPC game
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net 30minutes 2005 2008 access account application arithmetic array arrays basic binary bing button buttons c# center check checkbox code combobox component connectionstring convert crystalreport data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dropdownlist excel file-dialog folder ftp generatetags google gridview hardcopy image images inline insert intel internet listview mobile monitor ms net networking output passingparameters peertopeervideostreaming picturebox picturebox1 plugin port print printing problem problemwithinstallation project reports" save searchbox searchvb.net select serial server soap sorting table tcp text textbox timer toolbox trim update updown user vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web wpf





