Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 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
 
Old February 2nd, 2005, 03:51 PM
Authorized User
 
Join Date: Aug 2003
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Connecting to oracle using ASP.NET Error

I receive this error message when I attempt to look at the rowcount.
I have included my code and displayed the error message below. Any suggestions.

Thanks!
-----------------------------------CODE---------------------------------------------------
Dim SQL_COUNT = ("SELECT COUNT(*) " & _
"FROM customer join phone on (customer.customer = phone.customer) " & _
"Where phone.phone_type = 'EMAIL' " & _
"AND customer.customer = '" & IFTMemberId & "'")

Try
OConn.Open()
Console.WriteLine("Connection to Oracle database established successfully !")
Console.WriteLine(" ")

Catch ex As Exception

Console.WriteLine(ex.Message)
End Try

Dim cmd As OracleCommand = New OracleCommand(SQL_COUNT)
'cmd.CommandType = CommandType.Text
cmd.ExecuteScalar()
If cmd.ExecuteScalar() = 0 Then
Session("InvalidMemeber") = "True"
Response.Redirect("Welcome.aspx")
End If
If cmd.ExecuteScalar > 1 Then
Session("MultipleEmails") = "True"
Response.Redirect("Welcome.aspx")
End If
OConn.Close()
----------------------------------------------ERROR MESSAGE---------------------------------------------

Invalid operation. The connection is closed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Invalid operation. The connection is closed.

Source Error:


Line 59: Dim cmd As OracleCommand = New OracleCommand(SQL_COUNT)
Line 60: 'cmd.CommandType = CommandType.Text
Line 61: cmd.ExecuteScalar()
Line 62: If cmd.ExecuteScalar() = 0 Then
Line 63: Session("InvalidMemeber") = "True"


Source File: c:\inetpub\wwwroot\EmailUpdateForm\dbprocess.aspx. vb Line: 61

Stack Trace:


[InvalidOperationException: Invalid operation. The connection is closed.]
System.Data.OracleClient.OracleCommand.GetStatemen tHandle()
System.Data.OracleClient.OracleCommand.ExecuteScal arInternal(Boolean needCLStype, Boolean needRowid, OciHandle& rowidDescriptor)
System.Data.OracleClient.OracleCommand.ExecuteScal ar()
EmailUpdateForm.dbprocess.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\EmailUpdateForm\dbprocess.aspx. vb:61
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()

Sanjeet
__________________
Sanjeet
 
Old February 3rd, 2005, 01:19 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

I think you need to change this line:
Dim cmd As OracleCommand = New OracleCommand(SQL_COUNT)

To:

Dim cmd As OracleCommand = New OracleCommand(SQL_COUNT, oConn)

You are not assigning the connection to the command.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error While Connecting to Oracle 9i via .Net soft4net ADO.NET 1 December 21st, 2006 03:14 AM
Error in Connecting to Oracle vikasagarwal1984 ASP.NET 1.0 and 1.1 Basics 1 October 1st, 2006 01:03 PM
connecting asp.net to oracle farsfar2 ASP.NET 1.0 and 1.1 Basics 1 January 1st, 2006 04:38 PM
connecting oracle with asp.net rajatake General .NET 2 June 28th, 2005 01:45 AM
Error Connecting to MySQL with ASP.Net arovner Classic ASP Databases 0 April 27th, 2005 01:49 PM





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