Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Stops Writing To My Database

Status
Not open for further replies.

scripter73

Programmer
Apr 18, 2001
421
US
Hi,

I have an ASP script that does some text file manipulation and then opens an Access database to write the data to a table, and then later it opens the same database to write to another table.

Here's the code for the first table write:


'********************************************************
'OPEN DATABASE CONNECTION - write data to database
'********************************************************
'create connection to database using dsn

dim adopenforwardonly, adlockreadonly, adcmdtable
adopenforwardonly = 0
adlockreadonly = 1
adcmdtable = 2

dim objconn, objrs
set objconn = server.createobject("ADODB.Connection")
set objrs = server.createobject("ADODB.Recordset")

'line 461
dim strdatabasetype
strdatabasetype = "Access"

'6/27/01 adding commands
MdbFilePath = Server.MapPath("TargetURL.mdb")
objconn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";" (line 468)

objrs.open "Alog", objconn, adopenforwardonly, adlockreadonly, adcmdtable


'add new record
'check to make sure file data to upload is from CONNECT or DOMINO log file

if (strcomp(filechars, "NC") = 0) OR (strcomp(filechars, "AC")=0) then
strSQL = "INSERT INTO Alog (Host_Addr, UserID, LogDate, LogTime, LogRequest, RefURL, OpSysURL) VALUES ('" & _
strHost &"'," & "'" & strUser & "'," & "'" & datDate &"','" & strFinalTime & "','" & strRequest & "'," & "'" & strRefURL & "'," & "'" & strOpSys & "')"


objConn.Execute strSQL

end if


The error I'm getting is:

Microsoft OLE DB Provider for ODBC Drivers error 80004005
[Microsoft][ODBC Microsoft Access 97 Driver] Too many client tasks.

/logs/split.asp, line 468



Can somebody tell me what's going on? Access will allow about 63 records and then just shuts down business. I've been working on these error types for about 3 weeks and its becoming frustrating.

Any help is appreciated.

Thanks,
scripter73
 
So this code is called once for each insert?
Couple of things ..
What point does objrs serve there?
You never close recordset and connection objects once
finished with them, and at a guess Access can only cope
with 64 concurrent connections .. <insert witticism here>
codestorm
 
First off thanks for all of your help.

Here’s some more info on my goal:

I have an application that basically reads text log files, manipulates data, and then writes to an Access database.

Consider (if you will) a file MAINFILE.ASP that calls FILEA.ASP. FILEA.ASP calls either FILEB.ASP or FILEC.ASP depending on user selection.

Now for the connections. I’m a little confused. Since Access can only handle 64 concurrent connections, what does Access “consider” a connection?

?set conn = server.createobject(“ADODB.Connection”)
?set rs = server.createobject(“ADODB.Recordset”)
?conn.Open &quot;Driver={Microsoft Access Driver (*.mdb)}; DBQ=&quot; & MdbFilePath & &quot;;&quot;


If all of these are considered connections, then I’m very guilty of sprinkling my code with them. However, I have the above connections in my MAINFILE.ASP code, but I do close them with standard rs.close, conn.close, set rs=nothing, and set conn=nothing. So shouldn’t that delete this connection in Access’ mind?

Consider also that in my FILEB.ASP/FILEC.ASP, I open one database connection to insert records into my Table1 and before closing those connections, I open the same database to insert records into a Table2. My reasoning for this was because when I first coded it, I couldn’t write to different tables under the same connection.

Everything you’re saying is making sense. So I guess my question really is, “Do all of these things like server.createobject and conn.Open count as concurrent connections to Access database?” If they do, then I’ll try to cut down my open connections.

About the recordset you mentioned? I don’t need it? Isn’t that what allows me to open my tables. I don’t understand why I don’t need it. Please advise.

In order for you to review what I’m doing, I’ll put the text code here (sorry for length):

<html><head>
<title>String Splitting</title>
<body><font face=&quot;Verdana, Arial, Helvetica&quot;>

<%
response.write &quot;***************************** CONNECT LOG FILE PROCESSING ***********************&quot; & &quot;<BR><BR>&quot;
'***************************************
' LOG FILE VARIABLE DECLARATION
'***************************************
dim LogFile, LogFileObj

'LogFile = &quot;d:\inetpub\ & Session(&quot;ufilename&quot;)
LogFile = &quot;d:\inetpub\ & Session(&quot;ufilename&quot;)
'LogFile = Session(&quot;ufilename&quot;)
filechars = UCase(Left(Session(&quot;ufilename&quot;),2)) 'holds the characters that define the log filename

Set LogFileObj = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)

'STRING DECLARATION

dim strSave 'string used to hold the single-quoted log-line
dim theString

'ARRAY DECLARATION

dim theParts, theParts2, theParts3
dim svrParts

'HOLDING VARIABLES
dim strRequest
dim strHost, strIdentd, strUser, strTime, strRealTime, strResult, strBytes
dim strFound
dim numberChar, firstfour
dim strRefURL, strOpSys

'DATABASE VARAIBLES
dim firstfilewrite


'=============FUNCTION START

Function StrQuoteReplace(strValue)
'Replace any double quote in strValue with a single quote.
'The second argument to Replace consists of
'two double quotes enclosed in a pair of double quotes.
'The third argument to Replace consists of
'a single quote enclosed in a pair of double quotes.
'StrQuoteReplace = Replace(strValue, &quot;'&quot;, &quot;''&quot;) ' single in a double, and two singles in a double
StrQuoteReplace = Replace(strValue, &quot;&quot;&quot;&quot;, &quot;'&quot;)
End Function


Function fncGetDayOrdinal( _
byVal intDay _
)
' Accepts a day of the month as an integer and returns the
' appropriate suffix

Dim strOrd

Select Case intDay
Case 1, 21, 31
strOrd = &quot;st&quot;
Case 2, 22
strOrd = &quot;nd&quot;
Case 3, 23
strOrd = &quot;rd&quot;
Case Else
strOrd = &quot;th&quot;
End Select

fncGetDayOrdinal = strOrd
End Function ' fncGetDayOrdinal



Function fncFmtDate( _
byVal strDate, _
byRef strFormat _
)
' Accepts strDate as a valid date/time,
' strFormat as the output template.
' The function finds each item in the
' template and replaces it with the
' relevant information extracted from strDate

' Template items (example)
' %m Month as a decimal (02)
' %B Full month name (February)
' %b Abbreviated month name (Feb )
' %d Day of the month (23)
' %O Ordinal of day of month (eg st or rd or nd)
' %j Day of the year (54)
' %Y Year with century (1998)
' %y Year without century (98)
' %w Weekday as integer (0 is Sunday)
' %a Abbreviated day name (Fri)
' %A Weekday Name (Friday)
' %H Hour in 24 hour format (24)
' %h Hour in 12 hour format (12)
' %N Minute as an integer (01)
' %n Minute as optional if minute <> 0
' %S Second as an integer (55)
' %P AM/PM Indicator (PM)

On Error Resume Next

Dim intPosItem
Dim int12HourPart
Dim str24HourPart
Dim strMinutePart
Dim strSecondPart
Dim strAMPM

' Insert Month Numbers
strFormat = Replace(strFormat, &quot;%m&quot;, _
DatePart(&quot;m&quot;, strDate), 1, -1, vbBinaryCompare)

' Insert non-Abbreviated Month Names
strFormat = Replace(strFormat, &quot;%B&quot;, _
MonthName(DatePart(&quot;m&quot;, strDate), _
False), 1, -1, vbBinaryCompare)

' Insert Abbreviated Month Names
strFormat = Replace(strFormat, &quot;%b&quot;, _
MonthName(DatePart(&quot;m&quot;, strDate), _
True), 1, -1, vbBinaryCompare)

' Insert Day Of Month
strFormat = Replace(strFormat, &quot;%d&quot;, _
DatePart(&quot;d&quot;,strDate), 1, _
-1, vbBinaryCompare)

' Insert Day of Month Ordinal (eg st, th, or rd)
strFormat = Replace(strFormat, &quot;%O&quot;, _
fncGetDayOrdinal(Day(strDate)), _
1, -1, vbBinaryCompare)

' Insert Day of Year
strFormat = Replace(strFormat, &quot;%j&quot;, _
DatePart(&quot;y&quot;,strDate), 1, _
-1, vbBinaryCompare)

' Insert Long Year (4 digit)
strFormat = Replace(strFormat, &quot;%Y&quot;, _
DatePart(&quot;yyyy&quot;,strDate), 1, _
-1, vbBinaryCompare)

' Insert Short Year (2 digit)
strFormat = Replace(strFormat, &quot;%y&quot;, _
Right(DatePart(&quot;yyyy&quot;,strDate),2), _
1, -1, vbBinaryCompare)

' Insert Weekday as Integer (eg 0 = Sunday)
strFormat = Replace(strFormat, &quot;%w&quot;, _
DatePart(&quot;w&quot;,strDate,1), 1, _
-1, vbBinaryCompare)

' Insert Abbreviated Weekday Name (eg Sun)
strFormat = Replace(strFormat, &quot;%a&quot;, _
WeekDayName(DatePart(&quot;w&quot;,strDate,1),True), 1, _
-1, vbBinaryCompare)

' Insert non-Abbreviated Weekday Name
strFormat = Replace(strFormat, &quot;%A&quot;, _
WeekDayName(DatePart(&quot;w&quot;,strDate,1),False), 1, _
-1, vbBinaryCompare)

' Insert Hour in 24hr format
str24HourPart = DatePart(&quot;h&quot;,strDate)
If Len(str24HourPart) < 2 then str24HourPart = &quot;0&quot; & _
str24HourPart
strFormat = Replace(strFormat, &quot;%H&quot;, str24HourPart, 1, _
-1, vbBinaryCompare)

' Insert Hour in 12hr format
int12HourPart = DatePart(&quot;h&quot;,strDate) Mod 12
If int12HourPart = 0 then int12HourPart = 12
strFormat = Replace(strFormat, &quot;%h&quot;, int12HourPart, 1, _
-1, vbBinaryCompare)

' Insert Minutes
strMinutePart = DatePart(&quot;n&quot;,strDate)
If Len(strMinutePart) < 2 then _
strMinutePart = &quot;0&quot; & strMinutePart
strFormat = Replace(strFormat, &quot;%N&quot;, strMinutePart, _
1, -1, vbBinaryCompare)

' Insert Optional Minutes
If CInt(strMinutePart) = 0 then
strFormat = Replace(strFormat, &quot;%n&quot;, &quot;&quot;, 1, _
-1, vbBinaryCompare)
Else
If CInt(strMinutePart) < 10 then _
strMinutePart = &quot;0&quot; & strMinutePart
strMinutePart = &quot;:&quot; & strMinutePart
strFormat = Replace(strFormat, &quot;%n&quot;, strMinutePart, _
1, -1, vbBinaryCompare)
End if

' Insert Seconds
strSecondPart = DatePart(&quot;s&quot;,strDate)
If Len(strSecondPart) < 2 then _
strSecondPart = &quot;0&quot; & strSecondPart
strFormat = Replace(strFormat, &quot;%S&quot;, strSecondPart, 1, _
-1, vbBinaryCompare)

' Insert AM/PM indicator
If DatePart(&quot;h&quot;,strDate) >= 12 then
strAMPM = &quot;PM&quot;
Else
strAMPM = &quot;AM&quot;
End If

strFormat = Replace(strFormat, &quot;%P&quot;, strAMPM, 1, _
-1, vbBinaryCompare)

fncFmtDate = strFormat

'If there is an error output its value
If err.Number <> 0 then
Response.Clear
Response.Write &quot;ERROR &quot; & err.Number & _
&quot;: fmcFmtDate - &quot; & err.Description
Response.Flush
Response.End
End if
End Function ' fncFmtDate


'=============FUNCTION END


'**************************
'READ THE LOG FILE
'**************************
'show the filenames being used
response.write &quot;<br><font color='red'>Log Filename = &quot; & LogFile & &quot;</font><br>&quot;


Set LogFileObj = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)

response.write &quot;<hr>&quot;
response.write &quot;<br><font color=blue size=3 face=Verdana, Arial, Helvetica>&quot; & &quot;Processing Log File...&quot; & &quot;</font><br>&quot;
If LogFileObj.FileExists(LogFile) Then
Set LogTextFile = LogFileObj.OpenTextFile(LogFile)

firstfilewrite = 0 'set the firstpass to Filenames table to 0

Do While Not LogTextFile.AtEndOfStream
strSave = LogTextFile.Readline
strSave = strQuoteReplace(strSave)

'split each string into an array (initial split based on quote)
theString=strSave 'copy the current line to a buffer
theParts = split(strSave,&quot;'&quot;)

if Not LogTextFile.AtEndOfStream then
response.write &quot;<font color=blue size=2 face=Verdana, Arial, Helvetica>&quot;
response.write &quot;<br><i>Array:&quot; & &quot;</i><br></font>&quot;
end if
for i=lbound(theParts) to ubound(theParts)
response.write theParts(i) & &quot;<br>&quot;
next
response.write &quot;----------------------------------------------------------------------&quot; & &quot;<br>&quot;

'search each element in array looking for certain strings
strfound = false
for i=lbound(theParts) to ubound(theParts)
numberchar = left(theParts(i),4)

if (strcomp(numberchar, &quot;GET &quot;) = 0) OR (strcomp(numberchar, &quot;POST&quot;)) then
'assign that part to the strRequest variable
if i<>ubound(theParts) then
strRequest = theParts(i+1)
end if
strFound = true

'now that strRequest was located, replace its section in array with a flag
if i<>ubound(theParts) then
theParts(i+1) = &quot;null&quot;
end if
response.write &quot;<br>&quot;& &quot;Found either a GET or POST in the array.&quot; & &quot;<br>&quot;
response.write &quot;<br>Updating Array...&quot;
exit for 'after finding string, exit forloop
end if

next
response.write &quot;<br>&quot;

'show me theParts array
response.write &quot;<br><font color=blue size=2><i>&quot; & &quot;Array - <b>theParts</b>&quot; & &quot;</i></font><br>&quot;
for k=lbound(theParts) to ubound(theParts)
response.write theParts(k) & &quot;<br>&quot;
next

response.write &quot;----------------------------------------------------------------------&quot; & &quot;<br>&quot;

'copy new array to another string
theString2 = &quot;&quot;
for iloop=lbound(theParts) to ubound(theParts)
if (theParts(iloop)=&quot;null&quot;)=0 then
theString2 = theString2 & theParts(iloop)
end if 'build string with only non-null elements of array
next
'write out new string
response.write &quot;<br>Copying array to a new string...&quot;

response.write &quot;<br>&quot; & &quot;<b><font color=blue size=2>New String = </font></b>&quot; & theString2 & &quot;<br>&quot;

response.write &quot;<br><br>Splitting String into another array...<br>&quot;
response.write &quot;<b><font color=blue size=2>theParts2 = </font></b><br>&quot;

'split the string again into an array (based on spaces)
theParts2 = split(theString2, &quot; &quot;)
for l=lbound(theParts2) to ubound(theParts2)
response.write theParts2(l) & &quot;<br>&quot;
next

response.write &quot;----------------------------------------------------------------------&quot; & &quot;<br>&quot;

response.write &quot;<br>&quot;

'Resize new array
'previously defined dim x,y
y=-1
redim theParts2(ubound(theParts))
for x=0 to ubound(theParts)
if theParts(x) <> &quot;null&quot; then
y=y+1
theParts2(y) = theParts(x)
end if
next
redim preserve theParts2(y) 'resize down

response.write &quot;Resizing Array...&quot; & &quot;<br>&quot;
response.write &quot;The New <b><font color=blue size=2>theParts2</font></b><br>&quot;

for z=lbound(theParts2) to ubound(theParts2)
response.write theParts2(z) & &quot;<br>&quot;
next

response.write &quot;----------------------------------------------------------------------&quot; & &quot;<br>&quot;
response.write &quot;<br>&quot;

response.write &quot;Copy <b><font color=blue size=2>theParts2</font></b> into another string...<font color=blue><b>arrString</b></font>&quot;
strDelimiter=&quot;*&quot;
'join array items with string delimiter
arrString = Join(theParts2, strDelimiter)
response.write &quot;<br><font color=blue size=2>arrString</font> (After Delimiting)&quot; & &quot;<br>&quot; & arrString & &quot;<br>&quot;

response.write &quot;----------------------------------------------------------------------&quot; & &quot;<br>&quot;
response.write &quot;Copy string into third array: <font color=blue size=2><b>theParts3</b></font><br>&quot;
'split apart one more time
theParts3 = split(arrString, &quot; &quot;)
for n=lbound(theParts3) to ubound(theParts3)
response.write theParts3(n) & &quot;<br>&quot;
next
response.write &quot;----------------------------------------------------------------------&quot; & &quot;<br>&quot;
'*************************
'variable assignment
'*************************
for a=lbound(theParts3) to ubound(theParts3)
if instr(theParts3(a),&quot;.&quot;)<>0 then
'response.write &quot;You have a . in one of your strings!&quot; & &quot;<br>&quot;
strHost = theParts3(a)

else if instr(theParts3(a),&quot;[&quot;)<>0 then
'response.write &quot;You have a [ in one of your strings!&quot; & &quot;<br>&quot;
strTime = theParts3(a)
end if

end if

'strResult and strBytes aren't required in report, so this is extra information
if (a=(ubound(theParts3)-1))<>0 then
'response.write &quot;You've find the next to the last entry in array.&quot; & &quot;<br>&quot;
strResult = theParts3(a)

else if (a=(ubound(theParts3)))<>0 then
'response.write &quot;You've find the last entry in array.&quot; & &quot;<br>&quot;
strBytes = theParts3(a)
end if

end if


next

'Assign automatic values to these variables because this is a CONNECT log file.
strUser = &quot;- &quot;
strRefURL = &quot; &quot;
strOpSys = &quot; &quot;

'***************************
'staus reporting
'***************************
response.write &quot;<br>&quot; & &quot;<b>Status</b>&quot;
response.write &quot;<br>&quot; & &quot;Host(strHost) = &quot; & strHost
response.write &quot;<br>&quot; & &quot;User (strUser) = &quot; & strUser
strTime = Right(strTime, Len(strTime)-1)
response.write &quot;<br>&quot; & &quot;Date/Time (strTime)= &quot; & strTime
response.write &quot;<br>&quot; & &quot;String Request(strRequest) = &quot; & strRequest
response.write &quot;<br>&quot; & &quot;Referring URL (strRefURL) = &quot; & strRefURL
response.write &quot;<br>&quot; & &quot;OS (strOpSys) = &quot; & strOpSys
response.write &quot;<br>&quot;




'***************************
'string manipulations
'format data for database
'***************************
response.write &quot;<br><font color=blue size=2>Performing Date Time Manipulations...</font><br>&quot;
strTime=replace(strTime,&quot;:&quot;,&quot; &quot;,1,1)
response.write &quot;<br>&quot; & &quot;New Time is &quot; & strTime

strPreFinalTime = fncFmtDate(strTime,&quot;%m/%d/%y*%h:%N %P&quot;)
response.write &quot;<br>&quot; & &quot;Prefinal Time &quot; & strPreFinalTime

strTimeArray = split(strPreFinalTime, &quot;*&quot;)

strFinalDate = strTimeArray(0)
strFinalTime = strTimeArray(1)
response.write &quot;<br>&quot; & &quot;Final Date &quot; & strFinalDate
response.write &quot;<br>&quot; & &quot;Final Time &quot; & strFinalTime
datDate = CDate(strFinalDate)


response.write &quot;<br>----------------------------------------------------------------------&quot; & &quot;<br>&quot;
response.write &quot;<br><font color='blue' size=2>FinalItems to Write to Database <font color='red'>(Vartypes)</font><br>&quot;
response.write &quot;<br>&quot; & &quot;Host = &quot; & strHost & &quot; <font color='red'>(&quot; & vartype(strHost) & &quot;)</font>&quot;
response.write &quot;<br>&quot; & &quot;User_ID = &quot; & strUser & &quot; <font color='red'>(&quot; & vartype(strUser) & &quot;)</font>&quot;
response.write &quot;<br>&quot; & &quot;Date = &quot; & datDate & &quot; <font color='red'>(&quot; & vartype(datDate) & &quot;)</font>&quot;
response.write &quot;<br>&quot; & &quot;Time = &quot; & strFinalTime & &quot; <font color='red'>(&quot; & vartype(strFinalTime) & &quot;)</font>&quot;
response.write &quot;<br>&quot; & &quot;URL = &quot; & strRequest & &quot; <font color='red'>(&quot; & vartype(strRequest) & &quot;)</font>&quot;
response.write &quot;<br>&quot; & &quot;Referring URL = &quot; & strRefURL & &quot; <font color='red'>(&quot; & vartype(strRefURL) & &quot;)</font>&quot;
response.write &quot;<br>&quot; & &quot;Op Sys = &quot; & strOpSys & &quot; <font color='red'>(&quot; & vartype(strOpSys) & &quot;)</font>&quot;


datDate = CDate(strFinalDate)
response.write &quot;<br></font>&quot;

response.write &quot;<br><font color=blue size=2>Updating Database...</font><br>&quot;


'********************************************************
'OPEN DATABASE CONNECTION - write data to database
'********************************************************
'create connection to database using dsn

dim adopenforwardonly, adlockreadonly, adcmdtable
adopenforwardonly = 0
adlockreadonly = 1
adcmdtable = 2

dim objconn, objrs
set objconn = server.createobject(&quot;ADODB.Connection&quot;)
set objrs = server.createobject(&quot;ADODB.Recordset&quot;)

'line 461
dim strdatabasetype
strdatabasetype = &quot;Access&quot;

'MCF 6/27/01 adding commands
MdbFilePath = Server.MapPath(&quot;TargetURL2.mdb&quot;)
objconn.Open &quot;Driver={Microsoft Access Driver (*.mdb)}; DBQ=&quot; & MdbFilePath & &quot;;&quot;


'MCF 6/27/01 - GETTING ERROR (COMMENT OUT) objconn.open &quot;Provider=Microsoft.Jet.OLEDB.4.0;&quot; &_
' &quot;Data Source=d:\inetpub\ &_
' &quot;Persist Security Info=False&quot;

objrs.open &quot;Alog&quot;, objconn, adopenforwardonly, adlockreadonly, adcmdtable


'add new record
'check to make sure file data to upload is from CONNECT or DOMINO log file

if (strcomp(filechars, &quot;NC&quot;) = 0) OR (strcomp(filechars, &quot;AC&quot;)=0) then
strSQL = &quot;INSERT INTO Alog (Host_Addr, UserID, LogDate, LogTime, LogRequest, RefURL, OpSysURL) VALUES ('&quot; & _
strHost &&quot;',&quot; & &quot;'&quot; & strUser & &quot;',&quot; & &quot;'&quot; & datDate &&quot;','&quot; & strFinalTime & &quot;','&quot; & strRequest & &quot;',&quot; & &quot;'&quot; & strRefURL & &quot;',&quot; & &quot;'&quot; & strOpSys & &quot;')&quot;


objConn.Execute strSQL

end if



if firstfilewrite=0 then
'***************************************************************
'OPEN 2nd DATABASE CONNECTION - write filename to table
'***************************************************************

'dim adopenforwardonly, adlockreadonly, adcmdtable
adopenforwardonly = 0
adlockreadonly = 1
adcmdtable = 2

dim strUFile
strUFile = Session(&quot;ufilename&quot;)

dim conn, rs
set conn = server.createobject(&quot;ADODB.Connection&quot;)
set rs = server.createobject(&quot;ADODB.Recordset&quot;)

dim dbtype
dbtype = &quot;Access&quot; 'line 500

'MCF 6/27/01 adding commands
MdbFilePath = Server.MapPath(&quot;TargetURL.mdb&quot;)
conn.Open &quot;Driver={Microsoft Access Driver (*.mdb)}; DBQ=&quot; & MdbFilePath & &quot;;&quot;


'MCF 6/27/01 - GETTING ERROR (COMMENT OUT) conn.open &quot;Provider=Microsoft.Jet.OLEDB.4.0;&quot; &_
' &quot;Data Source=d:\inetpub\ &_
' &quot;Persist Security Info=False&quot;

rs.open &quot;Filenames&quot;, conn, adopenforwardonly, adlockreadonly, adcmdtable

sqltext = &quot;INSERT INTO Filenames (ExistingFilename) VALUES ('&quot; & strUFile & &quot;')&quot;

Conn.Execute sqltext

rs.close
conn.close
set rs = nothing
set conn = nothing

firstfilewrite=1
end if
response.write &quot;<hr>&quot;


Loop 'do...while

Else response.write &quot;File Does Not Exist.&quot; & &quot;<br>&quot;

End IF

response.write &quot;<hr>&quot;

%>
</font>
</body>
</html>





Here’s my processing logic:

MAINFILE.ASP calls FILEA.ASP which calls either SPLIT.ASP which populates the Access database.

Thanks for all of your help. I really appreciate this service.

Scripter73
 
A connection in this case is an ADODB.Connection object.

Recordsets, Commands, etc are associated with a connection
object (they aren't extra connections to the database in
themselves).

A connection object is not connected to a database as such
until it's Open method is called (at which point it's open
until the Close method is called, or it is destroyed).

It's good practice to use the Close method, just in case
something goes screwy with simply destroying it
(=null, or nothing in VBS).

Err, what else..

You don't need a recordset to insert into a database, as
this doesn't need to return anything (same as delete and
update). You only need a recordset object if you want to
get some data from the database.

And yes, you can run multiple SQL queries, affecting
different tables (within the same database) from the one
connection.

(Though I seem to remember reading somewhere of
a problem running more than one stored procedure command
thru it together?)

OK, just looked thru the code ..
You don't close objconn, only conn.
Also you don't need the recordset objects.

Hope that helps. <insert witticism here>
codestorm
 
I got that same error the other day, after a SELECT statement to get data to update another database table with. So I saved the data in variables, closed the recordset before I did the objConn.Execute and all was well.

example:
objrs.open strSQL, 3, 1
mydata1 = objrs(0)
mydata2 = objrs(1)
objrs.close

strSQL = &quot;UPDATE table1 SET data1 = '&quot; & mydata1 & &quot; WHERE data2 = &quot; & mydata2 & &quot;'&quot;

objConn.Execute strSQL

And also, as codestorm mentions above, you don't need the recordset in the code you listed.....

joanne
 
Thanks codestorm/lobstah!

I did what you said codestorm, making sure I closed all of the connections that were opened, and also getting rid of the recordset connection.

Everything's working like a charm!

Thanks again, you're the best.

scripter73
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top