<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1018267" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1018267</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/cursor-problem#comment-1107392</link>
    <description> &lt;p&gt;I&#039;m still working on this one.&lt;/p&gt;
&lt;p&gt;Now I&#039;ve got some more information that might help someone come up with a suggestion.&lt;/p&gt;
&lt;p&gt;Here&#039;s the background:&lt;/p&gt;
&lt;p&gt;I am trying to write a script that will enter data from a tab delimated text file into an access file.&lt;br /&gt;
That part went ok once I made data entry conditioned on the line in the text file haveing the correct number of tab delimated fields.&lt;br /&gt;
Interestingly, the text data file I was given had two lines, out of over a thousand, which did not conform to the format of 23 fields.&lt;/p&gt;
&lt;p&gt;What I&#039;m trying to do now is to enable integration of future update data files of the same format. It will have to check each line to see that the title of the item has not been entered into the database previously before entering the data of that line.&lt;br /&gt;
The problem is using the movenext method of the recordset object inside the loop that reads the lines from the text file. &lt;/p&gt;
&lt;p&gt;There seems to be some kind of conflict between the movenext method of the recordset object and the readline method of the textStream object.&lt;br /&gt;
Should there be such a conflict? And if so can someone explain why? And what might I try to get around this problem? Should I throw the data into two dimesional array, close the recordset, and then check if there is data match against the array instead of the recordset?&lt;/p&gt;
&lt;p&gt;Here&#039;s all the commented code along with the error message.&lt;/p&gt;
&lt;p&gt;Technical Information (for support personnel)&lt;/p&gt;
&lt;p&gt;Error Type:&lt;br /&gt;
(0x80020009)&lt;br /&gt;
Exception occurred.&lt;br /&gt;
/akohlcom/m-pomeranz/asp/manager/rstest.asp, line 65&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;lt;% @ language= vbscript %&amp;gt;&lt;br /&gt;&amp;lt;% option explicit&lt;br /&gt;%&amp;gt;&lt;br /&gt;dim con1&lt;br /&gt;sub connection()&lt;br /&gt;	&amp;#039;**connection and recordset objects for local site***&lt;br /&gt;	 set con1=server.CreateObject(&amp;quot;adodb.connection&amp;quot;)&lt;br /&gt;	Con1.open &amp;quot;provider=microsoft.jet.oledb.4.0;data source=c:\db\m_pomeranz01c.mdb&amp;quot;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;end sub&lt;br /&gt;&amp;lt;!--#include virtual=&amp;quot;/includes/adovbs.inc&amp;quot;--&amp;gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;&lt;br /&gt;record set test page&lt;br /&gt;&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;hi&lt;br /&gt;&amp;lt;%&lt;br /&gt;function removeQuotes(str)&lt;br /&gt;	str=mid(str,2,len(str)-2)&lt;br /&gt;	removeQuotes=str&lt;br /&gt;end function&lt;br /&gt;			call connection()&lt;br /&gt;			dim rs1, sqlStr&lt;br /&gt;			set rs1 = server.CreateObject (&amp;quot;adodb.recordset&amp;quot;)&amp;#039;books&lt;br /&gt;			sqlStr=&amp;quot;SELECT books.book_id, books.title, books.subtitle, books.short_description, books.long_description,books.publisher_id&amp;quot;&lt;br /&gt;			sqlStr=sqlStr&amp;amp;&amp;quot; FROM books;&amp;quot;&lt;br /&gt;			rs1.open sqlStr,con1,3,3&lt;br /&gt;			const forReading=1&lt;br /&gt;			const forWriting=2&lt;br /&gt;			const forAppending=8&lt;br /&gt;			const tristateUseDefault=-2&lt;br /&gt;			const tristateTrue=-1&lt;br /&gt;			const TristateFalse=0&lt;br /&gt;			dim objFs, objTextS, page, file&lt;br /&gt;			&amp;#039;&amp;#039;this script enters the pk of a particular publisher&lt;br /&gt;			&amp;#039;&amp;#039;on every line. the number 1 sets it to artscroll.&lt;br /&gt;			dim pubId&lt;br /&gt;			pubId=1&lt;br /&gt;			page=&amp;quot;items.txt&amp;quot;&lt;br /&gt;			file=&amp;quot;c:\webtexts\&amp;quot;&amp;amp;page&lt;br /&gt;			set objFs=server.CreateObject(&amp;quot;scripting.filesystemObject&amp;quot;)&lt;br /&gt;			if objFs.fileExists(file)=true then&lt;br /&gt;					set ObjTextS=objFs.openTextFile(file, forReading,tristateFalse)&lt;br /&gt;					dim strArray, strLine, out ,tempNewTitle, tempOldTitle&lt;br /&gt;					dim i&lt;br /&gt;					i=0&lt;br /&gt;					objTextS.skipline&lt;br /&gt;					do while objTextS.atEndOfStream&amp;lt;&amp;gt;true&lt;br /&gt;							strLine= objTextS.readLine&lt;br /&gt;							strArray=split(strLine,vbTab)&lt;br /&gt;							if ubound(strArray)&amp;lt;&amp;gt;23 then&lt;br /&gt;								out=out&amp;amp;&amp;quot;&amp;lt;h1&amp;gt;the following data was not entered&amp;lt;/h1&amp;gt;&amp;quot;&lt;br /&gt;								out=out&amp;amp;&amp;quot;&amp;lt;p style=&amp;#039;color:green;font-family:zachary;&amp;#039;&amp;gt;It had an abberant number of tab delimated fields&amp;lt;/p&amp;gt;&amp;quot;&lt;br /&gt;								for i=0 to ubound(strArray)&lt;br /&gt;										out=out&amp;amp;strArray(i)&amp;amp;&amp;quot;&amp;lt;br&amp;gt;&amp;quot;&lt;br /&gt;								next&amp;#039;i&lt;br /&gt;								out=out&amp;amp;&amp;quot;&amp;lt;p&amp;gt; the line number is&amp;quot; &amp;amp;	objTextS.line&amp;amp;&amp;quot;&amp;lt;/p&amp;gt;&amp;quot;&lt;br /&gt;								out=out&amp;amp;&amp;quot;&amp;lt;p&amp;gt; the third substring, index is 2, is &amp;quot;&amp;amp;strArray(2)&amp;amp;&amp;quot;&amp;lt;/p&amp;gt;&amp;quot;&lt;br /&gt;								out=out&amp;amp;&amp;quot;&amp;lt;p style=&amp;#039;color:green;font-family:zachary;&amp;#039;&amp;gt; the last index of the array is &amp;quot;&amp;amp;ubound(strArray)&amp;amp;&amp;quot; and that&amp;#039;s why it wasn&amp;#039;t entered.&amp;lt;/p&amp;gt;&amp;quot;&lt;br /&gt;							else&amp;#039;if the line does have expected number of tab delimated fields &lt;br /&gt;								tempNewTitle=removeQuotes(strArray(1))&lt;br /&gt;									if tempNewTitle&amp;lt;&amp;gt;tempOldTitle then&lt;br /&gt;										response.write(&amp;quot;here is new title from text file &amp;quot;&amp;amp;tempNewTitle&amp;amp;&amp;quot;&amp;lt;br&amp;gt;&amp;quot;)&lt;br /&gt;										tempOldTitle=tempNewTitle&lt;br /&gt;&amp;#039;******when placed here there is and error from the rs1.movenext line****************&lt;br /&gt;										response.write(&amp;quot;&amp;lt;p&amp;gt;title field from db before text obj is closed inside the text obj loop&amp;quot;&amp;amp;rs1.fields(&amp;quot;title&amp;quot;)&amp;amp;&amp;quot;&amp;lt;/p&amp;gt;&amp;quot;)									&lt;br /&gt;										rs1.movenext &lt;br /&gt;										response.write(&amp;quot;&amp;lt;p&amp;gt;title field from db before text obj is closed inside the text obj loop&amp;quot;&amp;amp;rs1.fields(&amp;quot;title&amp;quot;)&amp;amp;&amp;quot;&amp;lt;/p&amp;gt;&amp;quot;)												&lt;br /&gt;&amp;#039;**************************************************************************&lt;br /&gt;&lt;br /&gt;								end if&amp;#039;the current line&amp;#039;s title was or was not read.&lt;br /&gt;							end if &amp;#039;there is or is not expected number of fields in text data file&lt;br /&gt;					loop&amp;#039;till end of file&lt;br /&gt;					response.write out		&lt;br /&gt;&amp;#039;******works here****************&lt;br /&gt;&amp;#039;			response.write(&amp;quot;&amp;lt;p&amp;gt;title field from db&amp;quot;&amp;amp;rs1.fields(&amp;quot;title&amp;quot;)&amp;amp;&amp;quot;&amp;lt;/p&amp;gt;&amp;quot;)									&lt;br /&gt;&amp;#039;			rs1.movenext &lt;br /&gt;&amp;#039;			response.write(&amp;quot;&amp;lt;p&amp;gt;title field from db&amp;quot;&amp;amp;rs1.fields(&amp;quot;title&amp;quot;)&amp;amp;&amp;quot;&amp;lt;/p&amp;gt;&amp;quot;)									&lt;br /&gt;&amp;#039;**************************			&lt;br /&gt;			&lt;br /&gt;			end if&amp;#039; the file exists&lt;br /&gt;			set objTextS=nothing&lt;br /&gt;			set objFs=nothing&lt;br /&gt;			response.write(&amp;quot;&amp;lt;p&amp;gt;filesystem object is closed&amp;lt;/p&amp;gt;&amp;quot;)&lt;br /&gt;&amp;#039;******works here****************&lt;br /&gt;&amp;#039;			response.write(&amp;quot;&amp;lt;p&amp;gt;title field from db&amp;quot;&amp;amp;rs1.fields(&amp;quot;title&amp;quot;)&amp;amp;&amp;quot;&amp;lt;/p&amp;gt;&amp;quot;)									&lt;br /&gt;&amp;#039;			rs1.movenext &lt;br /&gt;&amp;#039;			response.write(&amp;quot;&amp;lt;p&amp;gt;title field from db&amp;quot;&amp;amp;rs1.fields(&amp;quot;title&amp;quot;)&amp;amp;&amp;quot;&amp;lt;/p&amp;gt;&amp;quot;)									&lt;br /&gt;&amp;#039;**************************			&lt;br /&gt;					rs1.Close&lt;br /&gt;					set rs1=nothing&lt;br /&gt;			%&amp;gt;&lt;br /&gt;			&amp;lt;/body&amp;gt;&lt;br /&gt;			&amp;lt;/html&amp;gt;&lt;br /&gt;			&amp;lt;%&lt;br /&gt;			con1.close &lt;br /&gt;			set con1=nothing&lt;br /&gt;%&amp;gt;&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
 </description>
     <pubDate>Sat, 20 Apr 2002 22:14:24 +0000</pubDate>
 <dc:creator>akohl</dc:creator>
 <guid isPermaLink="false">comment 1107392 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/cursor-problem#comment-1107086</link>
    <description> &lt;p&gt;That looks ok. Did you experiment with different locktypes/cursors? Maybe try putting your whole find part in a variable, eg: &lt;/p&gt;
&lt;p&gt;strFind = &quot;title=&#039;&quot; &amp;amp; tempNewTitle &amp;amp; &quot;&#039; &quot;&lt;br /&gt;
rs1.find strFind&lt;/p&gt;
&lt;p&gt;Not sure what else to try.&lt;/p&gt;
 </description>
     <pubDate>Wed, 17 Apr 2002 02:26:38 +0000</pubDate>
 <dc:creator>Peter J. Boettcher</dc:creator>
 <guid isPermaLink="false">comment 1107086 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/server-side-scripting/cursor-problem#comment-1107062</link>
    <description> &lt;p&gt;And here are some more details that might be relevant&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt; set con1=server.CreateObject(&amp;quot;adodb.connection&amp;quot;)&lt;br /&gt;Con1.open &amp;quot;provider=microsoft.jet.oledb.4.0;data source=c:\db\1c.mdb&amp;quot;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;set rs1 = server.CreateObject (&amp;quot;adodb.recordset&amp;quot;)&amp;#039;books&lt;br /&gt;set rs2 = server.CreateObject (&amp;quot;adodb.recordset&amp;quot;)&amp;#039;issue details&lt;br /&gt;set rs3 = server.CreateObject (&amp;quot;adodb.recordset&amp;quot;)&amp;#039;authors&lt;br /&gt;set rs4 = server.CreateObject (&amp;quot;adodb.recordset&amp;quot;)&amp;#039;authors/books&lt;br /&gt;&lt;br /&gt;sqlStr=&amp;quot;SELECT books.book_id, books.title, books.subtitle, books.short_description, books.long_description,&amp;quot;&lt;br /&gt;sqlStr=sqlStr&amp;amp;&amp;quot;&amp;nbsp; books.publisher_id&amp;quot;&lt;br /&gt;sqlStr=sqlStr&amp;amp;&amp;quot; FROM books;&amp;quot;&lt;br /&gt;rs1.open sqlStr,con1,3,3&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
 </description>
     <pubDate>Tue, 16 Apr 2002 19:21:51 +0000</pubDate>
 <dc:creator>akohl</dc:creator>
 <guid isPermaLink="false">comment 1107062 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
