Hello,
I am calling a stored procedure to populate a Repeater Control. What I need
to do is see if a name is in the list and if not, add it to the Repeater.
Is there a way to reset the OleDbDataReader back to the beginning after I
bind it to the Repeater control and then use "If spApproverList.HasRows" to
loop through the reader?
Thanks, sck10
'Open connection to database
Dim cnnSearch As OleDb.OleDbConnection = New
OleDb.OleDbConnection(strConnBsomApps)
cnnSearch.Open()
Dim spApproverList As OleDb.OleDbDataReader
Dim prmApproverList As OleDbParameter
Dim cmdApproverList As New OleDb.OleDbCommand(str00, cnnSearch)
cmdApproverList.CommandType = CommandType.StoredProcedure
'Declare Parameters
prmApproverList = cmdApproverList.Parameters.Add("@strParm01",
OleDbType.VarChar) : prmApproverList.Value = str01
'Data Bind: DropdownList
spApproverList = cmdApproverList.ExecuteReader()
ddlApproverList.DataSource = spApproverList
ddlApproverList.DataTextField = "Handle"
ddlApproverList.DataBind()
'ddlApproverList.Items.FindByValue(Me.hdnWebUser.V alue).Selected = True
Dim strHandleText As String = ""
If spApproverList.HasRows Then
Do While spApproverList.Read
If Not IsDBNull(spApproverList("Handle")) Then strHandleText =
CType(spApproverList("Handle"), String)
Loop
End If 2 6680
Hi,
data reader is read-only, forward-only. So if you read it to the end once
(like with databinding), you need to requery database in order to loop
through it again. If you want a result set that lasts more than one
iteration, use OleDbdataAdapter to fill a dataTable and loop through the
DataTable.
--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU http://blogs.aspadvice.com/joteke
"sck10" <sc***@online.nospamwrote in message
news:O6**************@TK2MSFTNGP04.phx.gbl...
Hello,
I am calling a stored procedure to populate a Repeater Control. What I
need to do is see if a name is in the list and if not, add it to the
Repeater. Is there a way to reset the OleDbDataReader back to the
beginning after I bind it to the Repeater control and then use "If
spApproverList.HasRows" to loop through the reader?
Thanks, sck10
'Open connection to database
Dim cnnSearch As OleDb.OleDbConnection = New
OleDb.OleDbConnection(strConnBsomApps)
cnnSearch.Open()
Dim spApproverList As OleDb.OleDbDataReader
Dim prmApproverList As OleDbParameter
Dim cmdApproverList As New OleDb.OleDbCommand(str00, cnnSearch)
cmdApproverList.CommandType = CommandType.StoredProcedure
'Declare Parameters
prmApproverList = cmdApproverList.Parameters.Add("@strParm01",
OleDbType.VarChar) : prmApproverList.Value = str01
'Data Bind: DropdownList
spApproverList = cmdApproverList.ExecuteReader()
ddlApproverList.DataSource = spApproverList
ddlApproverList.DataTextField = "Handle"
ddlApproverList.DataBind()
'ddlApproverList.Items.FindByValue(Me.hdnWebUser.V alue).Selected = True
Dim strHandleText As String = ""
If spApproverList.HasRows Then
Do While spApproverList.Read
If Not IsDBNull(spApproverList("Handle")) Then strHandleText =
CType(spApproverList("Handle"), String)
Loop
End If
Thanks Teemu...
"Teemu Keiski" <jo****@aspalliance.comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
Hi,
data reader is read-only, forward-only. So if you read it to the end once
(like with databinding), you need to requery database in order to loop
through it again. If you want a result set that lasts more than one
iteration, use OleDbdataAdapter to fill a dataTable and loop through the
DataTable.
--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU http://blogs.aspadvice.com/joteke
"sck10" <sc***@online.nospamwrote in message
news:O6**************@TK2MSFTNGP04.phx.gbl...
>Hello,
I am calling a stored procedure to populate a Repeater Control. What I need to do is see if a name is in the list and if not, add it to the Repeater. Is there a way to reset the OleDbDataReader back to the beginning after I bind it to the Repeater control and then use "If spApproverList.HasRows" to loop through the reader?
Thanks, sck10
'Open connection to database Dim cnnSearch As OleDb.OleDbConnection = New OleDb.OleDbConnection(strConnBsomApps) cnnSearch.Open()
Dim spApproverList As OleDb.OleDbDataReader Dim prmApproverList As OleDbParameter Dim cmdApproverList As New OleDb.OleDbCommand(str00, cnnSearch) cmdApproverList.CommandType = CommandType.StoredProcedure 'Declare Parameters prmApproverList = cmdApproverList.Parameters.Add("@strParm01", OleDbType.VarChar) : prmApproverList.Value = str01
'Data Bind: DropdownList spApproverList = cmdApproverList.ExecuteReader() ddlApproverList.DataSource = spApproverList ddlApproverList.DataTextField = "Handle" ddlApproverList.DataBind() 'ddlApproverList.Items.FindByValue(Me.hdnWebUser.V alue).Selected = True
Dim strHandleText As String = "" If spApproverList.HasRows Then Do While spApproverList.Read If Not IsDBNull(spApproverList("Handle")) Then strHandleText = CType(spApproverList("Handle"), String) Loop End If This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Donald Williamson |
last post by:
I have a DataReader that I am binding to a Repeater control. In the
DataReader, I have two fields: 'Name1' and 'Name2'
'Name1' will always have a person's name. Name2 periodically has a person's...
|
by: Thomas R |
last post by:
Is is possible?
In VS.NET 2003, Binding data to the repeater is easy, but when I try to add
an ASP:checkbox to the .aspx page, the designer won't recognize it, hence
the code view doesn't allow...
|
by: Dot net work |
last post by:
Hello.
I have an interesting data binding scenario:
I have a repeater control. It repeats a typical custom web user
control.
I also have a collection object, and each collection element...
|
by: Charlie |
last post by:
Hi:
I have one-to-many relation (customer > invoice > invoice_items) that I
would like to display on web page using Repeater control. Can the control
be bound to a heirarchical dataset to...
|
by: olduncleamos |
last post by:
Hello all,
I am experimenting with the repeater control and ran into something
that I wasn't expecting. I would appreciate if the experts can confirm
or correct my understanding.
Here is a...
|
by: Dave |
last post by:
I have a button in the same page as the repeter control, so when I click
that I need to loop threw the repeater and get the value of each textbox and
id
Dave
|
by: Andrew |
last post by:
Hi,
I have a problem capturing the checkboxes that are checked, I get false
irrespective of wether they are checked or not.
I have gone thru the sample code on this forum, but they dun seem to...
|
by: ratnakarp |
last post by:
Hi,
I have a search text box. The user enters the value in the text box and
click on enter button. In code behind on button click i'm writing the
code to get the values from the database and...
|
by: Hendrik |
last post by:
Hi
I'm trying to put a image button on a repeater control
The repeater control is bound to an array at run time
On page startup everything works fine
Because the binding is done in the "not Is...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |