superdog4492
Programmer
Hi There!
I'm having a hard time with my ASP connection to SQL Server 6.5. I'm looping through a recordset, and each iteration sets and frees a couple of other recordsets. (Code below.)
I think I'm being really good about creating as late as possible and freeing as soon as possible, but I'm still getting this error sometimes:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
[Microsoft][ODBC SQL Server Driver][SQL Server]Unable to connect. The maximum number of '25' configured user connections are already connected. System Administrator can configure to a higher value with sp_configure.
I only get this code when the Answers recordset gets too big (but I haven't been able to identify any threshold -- it's way lower that 25!
Can anyone see what I'm doing wrong in my code? I've heard connection.execute can be a little unruly - is that it?
Thanks in advance for your help!
Dave
'connect to database
Dim objConn
set objConn = server.CreateObject("ADODB.Connection"
objConn.Open "Driver={SQL Server};Server=MyServer;Uid=SA;Pwd=;Database=myDatabase"
'SAVE ANSWERS
QUESTION = "SELECT question.question_id, inputType "
QUESTION = QUESTION & "FROM question"
QUESTION = QUESTION & " WHERE question.subProcess_id = " & request.form("SelectedSubProcess"
set Answers=objConn.execute(QUESTION)
do while not Answers.eof
AnswerText = request.form(Answers(0))
EACH_ANSWER = "UPDATE Answer_" & Session("EnteredAlias"
& " SET submitted_on = '" & FormatDateTime(Date) & "'"
EACH_ANSWER = EACH_ANSWER & ", submitted_by = '" & Session("UserName"
& "'"
EACH_ANSWER = EACH_ANSWER & ", answerText = '" & AnswerText & "'"
EACH_ANSWER = EACH_ANSWER & " WHERE question_ID = " & Answers(0)
set UpdateAnswers=objConn.execute(EACH_ANSWER)
set UpdateAnswers = nothing
Answers.movenext
loop
Answers.close
' clean up
set Answers = nothing
objConn.close
set objConn = nothing
I'm having a hard time with my ASP connection to SQL Server 6.5. I'm looping through a recordset, and each iteration sets and frees a couple of other recordsets. (Code below.)
I think I'm being really good about creating as late as possible and freeing as soon as possible, but I'm still getting this error sometimes:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
[Microsoft][ODBC SQL Server Driver][SQL Server]Unable to connect. The maximum number of '25' configured user connections are already connected. System Administrator can configure to a higher value with sp_configure.
I only get this code when the Answers recordset gets too big (but I haven't been able to identify any threshold -- it's way lower that 25!
Can anyone see what I'm doing wrong in my code? I've heard connection.execute can be a little unruly - is that it?
Thanks in advance for your help!
Dave
'connect to database
Dim objConn
set objConn = server.CreateObject("ADODB.Connection"
objConn.Open "Driver={SQL Server};Server=MyServer;Uid=SA;Pwd=;Database=myDatabase"
'SAVE ANSWERS
QUESTION = "SELECT question.question_id, inputType "
QUESTION = QUESTION & "FROM question"
QUESTION = QUESTION & " WHERE question.subProcess_id = " & request.form("SelectedSubProcess"
set Answers=objConn.execute(QUESTION)
do while not Answers.eof
AnswerText = request.form(Answers(0))
EACH_ANSWER = "UPDATE Answer_" & Session("EnteredAlias"
EACH_ANSWER = EACH_ANSWER & ", submitted_by = '" & Session("UserName"
EACH_ANSWER = EACH_ANSWER & ", answerText = '" & AnswerText & "'"
EACH_ANSWER = EACH_ANSWER & " WHERE question_ID = " & Answers(0)
set UpdateAnswers=objConn.execute(EACH_ANSWER)
set UpdateAnswers = nothing
Answers.movenext
loop
Answers.close
' clean up
set Answers = nothing
objConn.close
set objConn = nothing