Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 26th, 2007, 01:51 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default expression does not produce a value

Can anyone tell me in debugging I get the error expression does not produce a value
  myCollection.Add(reader.GetInt32(0))

Dim DBConn As IDbConnection = New SqlConnection



(DBConnString.getConnectionString())

            Dim DBCommand As IDbCommand = New SqlCommand
            DBCommand.CommandText = Session("SQLOutput")

            DBCommand.CommandType = CommandType.Text ' Try the intellisense Jason

            DBCommand.Connection = DBConn
            DBConn.Open()
            reader = DBCommand.ExecuteReader(CommandBehavior.CloseConne ction) ' <- this closes the connection to the db when you close the reader Jason
            Dim myCollection As New Collection
            Dim recordCount As Integer
            While reader.Read()
                recordCount = recordCount + 1
                myCollection.Add(reader.GetInt32(0).ToString)


            End While


  #2 (permalink)  
Old June 27th, 2007, 01:33 AM
Authorized User
 
Join Date: Jun 2006
Location: , , .
Posts: 47
Thanks: 0
Thanked 2 Times in 2 Posts
Default

hi.
see as i think u have closed the connection first & then u r trying to to fetch reader. with reader u have to make connection open until reader is working.
this is wat i think.
else u can use dataset instead of datareader.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Query does not produce desired result snufse SQL Server 2005 0 July 2nd, 2008 12:14 PM
Chapter 8 - Code doesn't produce a DropDownList cscooper2000 BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 0 November 3rd, 2007 06:16 PM
post back of an asp.imagebutton produce error gbianchi ASP.NET 2.0 Professional 6 July 11th, 2007 10:00 AM
Can a Make Table Query produce a Linked table? kronik Access 5 May 16th, 2006 06:17 AM
Write a program to produce a contents page eapsokha Java GUI 1 September 7th, 2004 11:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.