Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


VBscript error [Microsoft][ODBC Microsoft Access D

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,408
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VBscript error [Microsoft][ODBC Microsoft Access D
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 VBscript error [Microsoft][ODBC Microsoft Access D - 10/1/2001 12:27:11 PM   
  chrhas

 

Posts: 2
Score: 0
Joined: 10/1/2001
From: USA
Status: offline
I'm posting this here in the hopes that someone can explain to me why this script is crashing.

The following is a script that I am running trying to pull a specific set of records from an access DB. Note The variable Request.QueryString("Name") is a text string in the format of last,firstname. The variable is passing correctly.

<% @ Language=VBScript %>
<%
response.buffer = true
Const adOpenDynamic = 3, adLockOptimistic = 3
set conn = server.createobject("ADODB.Connection")
set rs = server.createobject("ADODB.Recordset")

mystring = Request.QueryString("Name")
myarray = Split(mystring, ",")

conn.open Application("phone_connectionString")

Query = "SELECT * FROM isphone WHERE (Name LIKE " & myarray(0) & ")"
rs.Open Query, conn, adOpenDynamic, adLockOptimistic
On Error Resume Next
%>

When attempting to run the query I receive the following error message:

Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

/is_oncall/is_phone_info.asp, line 15

Can anyone shed any light on why this is happening.

Thanks,
Chris
chris.hasbrouck@bassett.org
aol im: damnskippy101
 
 
Post #: 1
 
 Re: VBscript error [Microsoft][ODBC Microsoft Access D - 10/1/2001 6:08:21 PM   
  imav8n

 

Posts: 95
Score: 0
Joined: 7/3/2001
From: USA
Status: offline
Try this:

Take the parentheses out of the SQL statement. I used Yahoo and did a search for 80040e10 and it returned this Knowledge Base article from Microsoft:

-----------------------------------

This error occurs only with Microsoft Access when one of the column names specified in a select statement does not exist in the table being queried.

-------------------------------------

Here is the link to the whole article:
http://support.microsoft.com/support/kb/articles/Q216/4/25.asp

~imav8n


Edited by - imav8n on 10/02/2001 00:09:13

(in reply to chrhas)
 
 
Post #: 2
 
 Re: VBscript error [Microsoft][ODBC Microsoft Access D - 10/1/2001 6:13:22 PM   
  imav8n

 

Posts: 95
Score: 0
Joined: 7/3/2001
From: USA
Status: offline
Another thing you could try, just to see if you actually do have the query formatted correctly, is:

<% @ Language=VBScript %>
<%
response.buffer = true
Const adOpenDynamic = 3, adLockOptimistic = 3
set conn = server.createobject("ADODB.Connection")
set rs = server.createobject("ADODB.Recordset")

mystring = Request.QueryString("Name")
myarray = Split(mystring, ",")

conn.open Application("phone_connectionString")

Query = "SELECT * FROM isphone WHERE (Name LIKE " & myarray(0) & ")"
' rs.Open Query, conn, adOpenDynamic, adLockOptimistic

Response.Write Query

On Error Resume Next
%>


Just comment out the Recordset and return the query....your page should be blank with the SQL statement at the top.

~imav8n

(in reply to chrhas)
 
 
Post #: 3
 
 Re: VBscript error [Microsoft][ODBC Microsoft Access D - 10/2/2001 8:38:22 AM   
  chrhas

 

Posts: 2
Score: 0
Joined: 10/1/2001
From: USA
Status: offline
Thanks!! I got it to work I needed t oadd single quotes around the variable name I was searching for. It's always the small things!!

Chris

(in reply to chrhas)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VBscript error [Microsoft][ODBC Microsoft Access D Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts