I am accessing and Oracle 8.05 database from an ASP. My problem is that it is doing double connections. This causes an error on SQL inserts with duplciate keys, as the first one inserts fine, but then it tries to do it a second time and I get a "duplicate key" error.

The code is as follows:

<DB Code in include file>
Dim mConn

Function OpenConnection()
Set mConn = CreateObject("ADODB.Connection")
mConn.Open "Provider=MSDAORA; Data Source=test; User ID=user;
End Function

Function CloseConnection()
Set mConn = Nothing
End Function

Function GetRecordset(pstrSQL)
Set GetRecordset = CreateObject("ADODB.Recordset")
Set GetRecordset = mConn.Execute(pstrSQL)
End Function

<Where this code is called>
Dim rsUser, strSQL, flAccessAllowed


strSQL = "select user_id from users where user_id = UPPER('" & strUser
& "')"

Set rsUser = GetRecordset(strSQL)
If not rsUser.bof and not rsUser.eof then
flAccessAllowed = true
end if

Set rsUser = nothing

strSQL = ""

There's no problem when "strSQL" is a select. When "strSQL" is an insert statement, this is where the error occurs. Has anyone seen this before and/or know why it is happening? I can look at the active sessions through Toad and it always creates two connections, even for just the above select.