| | |
Problem with no data when using objReader.Read()
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jun 2005
Posts: 1
Reputation:
Solved Threads: 0
Hi There,
I am very new to ASP.Net, just started to migrate this week.
I am also sorry if this question has been asked in the Forum already, i have searched but not found anything.
I am looking to pull some data from a database using the following code:
dim objCmd2 as OleDbCommand = new OleDbCommand("spSubPage", conn)
objCmd2.CommandType = CommandType.StoredProcedure
dim ObjReader2 as OleDbDataReader
objParam = objCmd2.Parameters.Add("@PageID", OleDbType.BSTR)
objParam.Direction = ParameterDirection.Input
objParam.Value = PageID
try
objCmd2.Connection.Open()
objReader2 = objCmd2.ExecuteReader()
dgSubPage.DataSource = objReader2
dgSubPage.DataBind()
objCmd2.Connection.Close()
catch ex as OleDbException
lblMessage.Text = "Sorry, there was an error"
end try
i am using a DataGrid to display the data.
This code is for a Content Management App where this query pulls out the sub page data and displayes the sub links on the right. Now, if there are no sublinks i dont want the sub link box to be displayed but i can't think of a way to do it in .Net, so i need some help. In asp this would be very simple, just using:
if not rsQuery.EOF
-- DISPLAY TABLE TOP --
while not rsQuery.EOF
-- DISPLAY SUB LINKS --
rsQuery.MoveNext
wend
--DISPLAY TABLE BASE
end if
but obviously this is not as efficient.
Look forward to hearing your suggestions, this (i think it will end up to be simple) task has been fustrating me for 2days now!
DiNo
I am very new to ASP.Net, just started to migrate this week.
I am also sorry if this question has been asked in the Forum already, i have searched but not found anything.
I am looking to pull some data from a database using the following code:
dim objCmd2 as OleDbCommand = new OleDbCommand("spSubPage", conn)
objCmd2.CommandType = CommandType.StoredProcedure
dim ObjReader2 as OleDbDataReader
objParam = objCmd2.Parameters.Add("@PageID", OleDbType.BSTR)
objParam.Direction = ParameterDirection.Input
objParam.Value = PageID
try
objCmd2.Connection.Open()
objReader2 = objCmd2.ExecuteReader()
dgSubPage.DataSource = objReader2
dgSubPage.DataBind()
objCmd2.Connection.Close()
catch ex as OleDbException
lblMessage.Text = "Sorry, there was an error"
end try
i am using a DataGrid to display the data.
This code is for a Content Management App where this query pulls out the sub page data and displayes the sub links on the right. Now, if there are no sublinks i dont want the sub link box to be displayed but i can't think of a way to do it in .Net, so i need some help. In asp this would be very simple, just using:
if not rsQuery.EOF
-- DISPLAY TABLE TOP --
while not rsQuery.EOF
-- DISPLAY SUB LINKS --
rsQuery.MoveNext
wend
--DISPLAY TABLE BASE
end if
but obviously this is not as efficient.
Look forward to hearing your suggestions, this (i think it will end up to be simple) task has been fustrating me for 2days now!
DiNo
![]() |
Similar Threads
- Updated : Simple ASP.Net Login Page (ASP.NET)
- Send data on a serial port (C++)
- Problem with retrieving data from access 2003 (Visual Basic 4 / 5 / 6)
- VB.Net: Problem Retrieve data from ListView (VB.NET)
- IIS connection will not write data (ASP)
- Populating & Retrieving Data in a listbox : ASP.NET (w/ VB.NET) (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: prblem:use a control in datagrid
- Next Thread: Error while building asp.net solution
| Thread Tools | Search this Thread |
.net activexcontrol advice ajax alltypeofvideos application asp asp.net bc30451 bottomasp.net box browser button c# c#gridviewcolumn checkbox click commonfunctions compatible confirmationcodegeneration content courier css dataaccesslayer database datagridview datagridviewcheckbox datalist deadlock development dgv dropdownlist dynamically edit expose feedback fileuploader fill flash form formatdecimal forms formview gridview gudi homeedition hosting iframe iis javascript jquery listbox login microsoft mono mouse mssql multistepregistration news numerical objects opera panelmasterpagebuttoncontrols parent radio redirect registration relationaldatabases reportemail rotatepage save schoolproject search security select silverlight smartcard smoobjects software sql-server sqlserver2005 suse textbox tracking unauthorized validation vb.net video videos virtualdirectory vista visualstudio web webapplications webdevelopemnt webprogramming webservice xml xsl youareanotmemberofthedebuggerusers





