473,323 Members | 1,547 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,323 software developers and data experts.

Problem with function in VBScript

I have a function like that:
Expand|Select|Wrap|Line Numbers
  1. Function ReadTable()
  2.     Dim objConnection
  3.     Dim objRecordset
  4.  
  5.     Set objConnection = Server.CreateObject("ADODB.Connection")
  6.     objConnection.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("data/testDB.mdb"))    
  7.  
  8.     Set objRecordset = Server.CreateObject("ADODB.Recordset")
  9.     objRecordset.Open "select * from myTable",objConnection
  10.     ReadTable = objRecordset    
  11. End Function
In my main program, I use this function like that:
Expand|Select|Wrap|Line Numbers
  1. Dim tableResult
  2. Set tableResult = ReadTable
  3. do while Not table.EOF
  4.     'some code here
  5. loop
I have an error "Object doesn't support this property or method: 'EOF'" for the statement: "do while Not table.EOF" in line 3. Why is it? I want the result of my ReadTable is a ADODB.Recordset. How can I do this? Thanks for any help.
May 29 '07 #1
3 1268
jhardman
3,406 Expert 2GB
Shouldn't this be
Expand|Select|Wrap|Line Numbers
  1. do while not tableResult.EOF
?
Everything else looks good. I can't see any other problem.

Jared
May 29 '07 #2
I'm very sorry about the typing mistake. In my code, it's:
Expand|Select|Wrap|Line Numbers
  1. Dim tableResult
  2. Set tableResult = ReadTable
  3. do while not tableResult.EOF
  4.         'some code here
  5. loop
But I have that error.
Please help me.
May 30 '07 #3
jhardman
3,406 Expert 2GB
I'm very sorry about the typing mistake. In my code, it's:
Expand|Select|Wrap|Line Numbers
  1. Dim tableResult
  2. Set tableResult = ReadTable
  3. do while not tableResult.EOF
  4.         'some code here
  5. loop
But I have that error.
Please help me.
Can you try it outside of a function? I mean just open the db as it is here but not inside of a function call. Perhaps simplifying the code would fix it or at least point out where the error is occuring.

Jared
May 30 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Kathryn | last post by:
Hiya I have a problem with using some client side and server side scripting together in an ASP. I'm using VBScript. What I'm trying to achieve is this - - Page loads up and some server side...
3
by: Andy | last post by:
Hi, I am complete JavaScript novice and would really appreciate some help with this code: ===================================================================== <%@LANGUAGE="VBSCRIPT"...
2
by: sjanie | last post by:
The error code is: Microsoft JScript compilation error '800a03ec' Expected ';' /bicc.nl/Connections/BICCwebsite.asp, line 2 Set Conn = Server.CreateObject("ADODB.Connection") ----^
0
by: Kamyk | last post by:
Hello all! I have problem with code. Firstly I have created the VBScript code which count me the time and days which left to the end of working week. I work from 8:00 am till 4 pm. I would like...
3
by: Wayne Wengert | last post by:
I am trying to run the web page example given in the VSNET 2003 Help for "Introduction to the DOM". I saved the example as an aspx page but when I run it I get the following error which I don't...
3
by: useenmelately | last post by:
Hello, I am working with asp.net 2.0 and have run into a problem with the custom validators. The client validation functions were originally written in vbscript, but as this is not compatible...
2
by: shookim | last post by:
I have a problem with my javascript code. The window.onload function doesn't get called when there is vbscript between the two. Here is my code which works: <script type="text/javascript">...
19
by: thisis | last post by:
Hi All, i have this.asp page: <script type="text/vbscript"> Function myFunc(val1ok, val2ok) ' do something ok myFunc = " return something ok" End Function </script>
9
by: djconner | last post by:
I'm a total neophyte in Javascript, trying to hack something together fast, and run into something that I can't understand at all. Two loops appear in sequence. The idea is that arrQuestions...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.