Print Page | Close Window

Datareader error - High priority

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=5862
Printed Date: 29 March 2026 at 2:48am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Datareader error - High priority
Posted By: Diep-Vriezer
Subject: Datareader error - High priority
Date Posted: 20 September 2003 at 8:06am

Hi all,

Why do I recieve this error:

Invalid attempt to Read when reader is closed.

When I use the following code:

Dim VerifyConnection As New OleDbConnection(), VerifyCommand As New OleDbCommand(), VerifyDatareader As OleDbDataReader, VerifyString As String

With VerifyConnection

.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Pub\wwwroot1\Components\Databases\Account\Account. mdb;User Id=admin;Password=;"

End With

With VerifyCommand

.CommandText = "SELECT Ip, Banned FROM tblIpbanned WHERE Ip = '" & Request.ServerVariables("REMOTE_HOST") & "'"

.CommandType = CommandType.Text

.Connection = VerifyConnection

End With

VerifyConnection.Open()

VerifyCommand.Prepare()

VerifyDatareader = VerifyCommand.ExecuteReader()

The error occurs at the bold line. The weird part (or maybe the logic part ) is that this error only occurs when the given IP matches the IP in the database. It doesn't matter if the value in the Banned table is 0 or 1 or something else.

This is a high priority topic (or as I named it) because my site can't bann ip's nor account's now, so I really need an answer..



-------------
Gone..



Replies:
Posted By: dpyers
Date Posted: 20 September 2003 at 10:58am

Account. mdb

should be

Account.mdb



-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: Diep-Vriezer
Date Posted: 20 September 2003 at 11:09am

I know, it is like that, it is just that I copied it staight from VS.NET, so somehow a <space> got in it. I'll edit it.

Besides, if it really was that, the error would have been different and should be triggered at VerifyConnection.Open()



-------------
Gone..


Posted By: Diep-Vriezer
Date Posted: 22 September 2003 at 12:05pm
Please reply  it has been here almost a week now and not really usefull stuff...

-------------
Gone..


Posted By: MorningZ
Date Posted: 23 September 2003 at 6:55am

Originally posted by Diep-Vriezer Diep-Vriezer wrote:

Please reply  it has been here almost a week now and not really usefull stuff...

ya know man.. if someone knew the answer and could reply, rest assured that they would...

no reason to needlessly "bump" your post



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: Diep-Vriezer
Date Posted: 23 September 2003 at 7:56am

True, I should have shut up, but now I already did it..



-------------
Gone..



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net