473,231 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

Problem updating this recordset...

Lo all,

I'm having a little bit of trouble (betty...).

I have removed some of the obvious stuff from this example (like connections
being opened/closed etc)

I create a recordset in ASP (not linked to a database)

Set testRS = Server.CreateObject("ADODB.RecordSet")
testRS.Fields.Append "WebsiteID", adInteger
testRS.Fields.Append "WebsiteName", adVarchar, 20
testRS.Fields.Append "WebsiteDesc", adVarchar, 255
testRS.Fields.Append "WebsiteURL", adVarchar, 255
testRS.Fields.Append "Relevance", adInteger

testRS.Open

I then iterate through a secondset recordset (linked to a database) and dump
in all of my rows of data into my 'local' recordset.

Do While Not RS2.EOF

testRS.AddNew

testRS("WebsiteID") = RS2("WebsiteID")
testRS("WebsiteName") = RS2("WebsiteName")
testRS("WebsiteDesc") = RS2("WebsiteDesc")
testRS("WebsiteURL") = RS2("WebsiteURL")
testRS("Relevance") = RS2("Relevance")

testRS.Update

RS2.MoveNext
Loop

I now iterate through my local recordset and populate an array and look for
words with the string for each field (calling the GetSubstringCount
function)

Dim aFields(3)
testRS.MoveFirst

Do While Not testRS.EOF

aFields(0) = testRS("WebsiteName")
aFields(1) = testRS("WebsiteDesc")
aFields(2) = testRS("WebsiteMetaKeywords")
aFields(3) = testRS("WebsiteMetaDescription")

iCount = 0

For intLoop = 0 To UBound(aSearchCriteria)

For intLoop2 = 0 To UBound(aFields)

iCount = iCount + GetSubstringCount(aFields(intLoop2),
aSearchCriteria(intLoop), False)

Next

Next

testRS("Relevance") = iCount
testRS.Update

intTotalRelevance = intTotalRelevance + iCount

testRS.MoveNext
Loop

Ok - so thats pretty much the code, now then - my 'revelance' field for each
row needs to be a numeric value, initially I'd set this to be a Integer then
realised that I would get 12.35 as a result etc, so had a quick look at the
constants for the ado stuff and saw the adNumeric - which according to this
page :

http://www.able-consulting.com/ADODataTypeEnum.htm

can be used for the SQL Server version of Numeric/Decimal - so I figured I'd
use that...

So I've changed the above field appends to this :

Set testRS = Server.CreateObject("ADODB.RecordSet")
testRS.Fields.Append "WebsiteID", adInteger
testRS.Fields.Append "WebsiteName", adVarchar, 20
testRS.Fields.Append "WebsiteDesc", adVarchar, 255
testRS.Fields.Append "WebsiteURL", adVarchar, 255
testRS.Fields.Append "Relevance", adNumeric

But now everytime it runs I get this error :

Microsoft Cursor Engine error '80040e21'

Multiple-step operation generated errors. Check each status value.

/parasolit/statics/mainbody-search-results.asp, line 708

Line 708 is the line which tries to do this :

testRS("Relevance") = iCount

followed by

testRS.Update

When I leave it set as an integer its fine works ok but I dont get the
decimals, when I change it to numeric it goes tits up....

What I am trying to achieve is the population of at percentage value in
there - so if it goes and finds a couple of results they may be stored in
the local recordset (ready to dump to the page) like so :

58.35
41.65

etc etc

Can anyone see where I'm going wrong - I can post the entire page of code if
you want but its quite big and has lots of extra stuff not really relevant
to this problem.

Any info appreciated,

Regards

Rob
Jul 19 '05 #1
7 5023
"Rob Meade" wrote ...

[..snip..]

Incidentally, I do realise I could change it to a varchar and it would
probably accept the values but because I want to sort this column later I
assumed that I might get something like this :

1
2
3
33
4
5
6
66
67
68
7

etc, based on it being text rather than

1
2
3
5
6
7
33
66
67
68

Regards

Rob
Jul 19 '05 #2
Rob Meade wrote:

http://www.able-consulting.com/ADODataTypeEnum.htm

can be used for the SQL Server version of Numeric/Decimal - so I
figured I'd use that...

So I've changed the above field appends to this :

testRS.Fields.Append "Relevance", adNumeric

You need to set the NumericScale and Precision properties of the Field
separately when using adNumeric or adDecimal:

testRs("Relevance").Precision=5
testRs("Relevance").NumericScale = 2

HTH,
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #3
"Bob Barrows [MVP]" wrote...
You need to set the NumericScale and Precision properties of the Field
separately when using adNumeric or adDecimal:

testRs("Relevance").Precision=5
testRs("Relevance").NumericScale = 2


I so wish this stuff was in my vbScripts book!!!

Where do I add that then Bob - near the field appends?

Regards

Rob
Jul 19 '05 #4
"Bob Barrows [MVP]" wrote ...
You need to set the NumericScale and Precision properties of the Field
separately when using adNumeric or adDecimal:

testRs("Relevance").Precision=5
testRs("Relevance").NumericScale = 2


Hello again Bob,

thanks for that, I've added it beneath my code for the append.fields stuff,
just ran it and it works perfectly - :o)

Can you now tell me what they do :oD

I'm 'guessing' that numeric scale is for 2 decimal places - not sure about
the precision....

Thanks again

Rob
Jul 19 '05 #5
Just found this looking for something else- lol...

http://www.aspfaq.com/show.asp?id=2503
"Rob Meade" <ro**********@NOSPAMubht.swest.nhs.uk> wrote in message
news:eY****************@TK2MSFTNGP10.phx.gbl...
"Bob Barrows [MVP]" wrote...
You need to set the NumericScale and Precision properties of the Field
separately when using adNumeric or adDecimal:

testRs("Relevance").Precision=5
testRs("Relevance").NumericScale = 2


I so wish this stuff was in my vbScripts book!!!

Where do I add that then Bob - near the field appends?

Regards

Rob

Jul 19 '05 #6
Rob Meade wrote:
"Bob Barrows [MVP]" wrote...
You need to set the NumericScale and Precision properties of the
Field separately when using adNumeric or adDecimal:

testRs("Relevance").Precision=5
testRs("Relevance").NumericScale = 2
I so wish this stuff was in my vbScripts book!!!


It's not really vbscript: it's ADO. It's not surprising (to me, anyways)
that a vbscript book would not cover this.

ADO documentation is at msdn.microsoft.com/library - here's a link to the
starting point:
http://msdn.microsoft.com/library/en...dooverview.asp

Make sure you look up these properties so you understand what they do.

Where do I add that then Bob - near the field appends?

Yep. Actually, any time between the creation of the Field object and the
first attempt to add data to it.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #7
"Bob Barrows [MVP]" wrote ...
It's not really vbscript: it's ADO. It's not surprising (to me, anyways)
that a vbscript book would not cover this.

ADO documentation is at msdn.microsoft.com/library - here's a link to the
starting point:
http://msdn.microsoft.com/library/en...dooverview.asp

Make sure you look up these properties so you understand what they do.

Where do I add that then Bob - near the field appends?

Yep. Actually, any time between the creation of the Field object and the
first attempt to add data to it.


Many thanks again Bob :o)

Regards

Rob
Jul 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Roy Adams | last post by:
Hi everyone I'm trying to build a shopping cart app using a db the part I'm stuck on is the fact that, if someone adds a product that they have previously added to the cart. I've got it set up to...
2
by: Joseph Markovich | last post by:
I'm having some trouble with VB in Access 2000. I have a form that the user enters in just one number (in this case, it's a base salary) and then the program is going to do a bunch of math (which...
6
by: RC | last post by:
My code below will loop through all the records in the table, and when the if statement is true it goes to the ***Me.ContainerNumberProductsTable = GETContainerNumber.Value*** bit like should but...
5
by: msprygada | last post by:
I am having a problem with getting a recordset to fill with data in an Access Data Project from a SQL Server database. Here is the code example that is in the Access help files that I can get to...
2
by: barret bonden | last post by:
(closest newsgroup I could find) Error Type: ADODB.Recordset (0x800A0CB3) Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype....
34
by: Jeff | last post by:
For years I have been using VBA extensively for updating data to tables after processing. By this I mean if I had to do some intensive processing that resulted in data in temp tables, I would have...
2
by: Alexey.Murin | last post by:
The application we are developing uses MS Access 2003 database (with help of ADO). We have noticed that during massive records updating the size of the mdb file increases dramatically (from 3-4 to...
9
by: zMisc | last post by:
When I try to update record, I kept getting this error: Row cannot be located for updating. Some values may have been changed since it was last read. No other users are accessing the database...
5
by: Hexman | last post by:
I've come up with an error which the solution eludes me. I get the error: >An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in HRTest.exe > >Additional...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.