An exception occurred: 'Open'

sjohnson77

New member
Local time
Today, 01:17
Joined
Sep 15, 2005
Messages
8
Error Type:
Microsoft VBScript runtime (0x800A01FB)
An exception occurred: 'Open'
/bingohopasp/post.asp, line 428


I am getting this error when trying to insert a record into a recordset. It also locks up access and the only way to free it up again is to reset IIS. The insert works with some data, but not others...I have two examples.

Successful Data:
"
The rules below have been constructed to ensure every member of the Bingo Hop Web Portal has a pleasant and enjoyable experience while here. Please read them and avoid breaking any, as failure to do so may result with your account being suspended or banned permanently.[RETURN][RETURN]
"

Unsuccessful Data:
"
The rules below have been constructed to ensure every member of the Bingo Hop Web Portal has a pleasant and enjoyable experience while here. Please read them and avoid breaking any, as failure to do so may result with your account being suspended or banned permanently.[RETURN][RETURN]
1. Do not insult, make personal attacks or be rude to any members or staff of Bingo Hop.[RETURN]
2. Do not post private information about yourself or other members of Bingo Hop, such as home/e-mail addresses, telephone numbers, credit card details, etc,...[RETURN]
3. Do not post meaningless posts, one word posts or anything that may be considered as spam.[RETURN]
4. Do make random/multiple posts in order to raise your post count.[RETURN]
5. Do not register multiple accounts with Bingo Hop.[RETURN]
6. Do not post racist, sexist or demeaning messages to the forum.[RETURN][RETURN]
We reserve the right to remove offensive posts without notice.[RETURN][RETURN]
While these rules cover most common situations, they cannot anticipate everything. As a result, we reserve the right to take any actions we deem necessary to ensure these forums are not abused in any way.[RETURN][RETURN][RETURN]
Sincerely[RETURN][RETURN]Bingo Hop Admin
"

Here is the asp code:
Set Conn = Server.CreateObject("ADODB.connection")
Conn.Open(ConnStr)

Set MyRS = Server.CreateObject("ADODB.Recordset")

strSQL = "Execute ADD_THREAD '" & Hold_ForumID & "','" & strTitleContent & "','" & strUserID & "','" & Now() & "','" & strThreadStatus & "','0'"

MyRS.Open strSQL, ConnStr, 3

' Retrieve last ThreadID inserted.
strSQL = "Execute GET_LAST_THREADID '" & Hold_ForumID & "','" & strUserID & "'"

MyRS.Open strSQL, ConnStr, 3

strThreadID = MyRS("ThreadID")
MyRS.Close

strSQL = "Execute ADD_POST '" & Hold_ForumID & "','" & strThreadID & "','" & strUserID & "','" & Now() & "','" & strPostContent & "','" & strPostIcon & "'"

MyRS.Open strSQL, ConnStr, 3
Line that fails.

Any help would be greatly appreciated.

Steve
 
Not very good with ASP, but it seems to be a problem of opening a recordset that is already open.
Look at your «MyRS.Open» and «MyRS.Close».
 
sjohnson77[COLOR="SeaGreen" said:
Set Conn = Server.CreateObject("ADODB.connection")
Conn.Open(ConnStr)

Set MyRS = Server.CreateObject("ADODB.Recordset")

strSQL = "Execute ADD_THREAD '" & Hold_ForumID & "','" & strTitleContent & "','" & strUserID & "','" & Now() & "','" & strThreadStatus & "','0'"

MyRS.Open strSQL, ConnStr, 3

' Retrieve last ThreadID inserted.
strSQL = "Execute GET_LAST_THREADID '" & Hold_ForumID & "','" & strUserID & "'"

MyRS.Open strSQL, ConnStr, 3

strThreadID = MyRS("ThreadID")
MyRS.Close

strSQL = "Execute ADD_POST '" & Hold_ForumID & "','" & strThreadID & "','" & strUserID & "','" & Now() & "','" & strPostContent & "','" & strPostIcon & "'"

MyRS.Open strSQL, ConnStr, 3 [/COLOR]Line that fails.

You could try taking out the MyRS.Close but it doesn't look as though that is the problem.
Can you post the underlying code for Add_POST or try this type of structure


Code:
'You open the DBConnection
Set dbConn = Server.CreateObject("ADODB.connection")
dbConn.Open(ConnStr)

' Then run the execute statements
sql = "execute ProcedureName " & parameters ' in your case ADD_THREAD
'  Execute the SQL statement
set rsUpdate = dbConn.Execute(sql)
'  Retrieve the id of record returned from the insert- SQL is inside the procedure
ThreadID= rsUpdate("THREADID")

' Then run the execute statements or retrieve last thread
sql = "execute ProcedureName " & parameters ' in your case ADD_POST
'  Execute the SQL statement
set rsUpdate = dbConn.Execute(sql)

set rsUpdate = Nothing
dbConn.close
set dbConn = Nothing

Hope this helps
 
Thank Newman, but I have explored that option and it doesn't appear to be the solution.

I know it appears like there are recordsets still open, but the first MyRS.Open runs and update query, which closes itself as soon as it runs (doesn't require an MyRS.Close).
 

Users who are viewing this thread

Back
Top Bottom