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