Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Sql script works for me in access but not in Ultradev generated ASP/VBS


Message #1 by "Gianpiero Colagiacomo" <gp@1...> on Sun, 25 Aug 2002 00:29:33
I'm running a command behaviour sql script from an asp/vbs page:

UPDATE members, memberships
SET accesslvl = 'member',   authtodate = IIf(authtodate<date(), date() +
duration, authtodate + duration),  netbanxref = varNetbanxRef,   
netbanxdate
= date()
WHERE username LIKE varUsername AND ref LIKE varMembership

It generates this error:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.

If I run the exact same sql from within Access itself it works fine,
updating the row expected with the correct data.  What's happening here?  I
realise the 'Too few parameters' error suggests that one or more of the
column names is/are invalid but they obviously are not otherwise the query
wouldn't run within Access (cut and paste the query so it's not my
typing!)...  The connection itself is fine as I can query/update tables
(including MEMBERS and MEMBERSHIPS) in the database with other pages in the
same site without fault.  Only this script is causing me problems.

What does the 'expected 2' mean?  2 columns that are invalid?  Is there 
someway to debug this???

The ASP generated by Ultradev looks like this:

<%

if("abcd" <> "") then updateAuth__varNetbanxRef = "abcd"

if("0000001" <> "") then updateAuth__varMembership = "0000001"

if("test4" <> "") then updateAuth__varUsername = "test4"

%>
<%
set news = Server.CreateObject("ADODB.Recordset")
news.ActiveConnection = MM_toptipsracing_STRING
news.Source = "SELECT * FROM news"
news.CursorType = 0
news.CursorLocation = 2
news.LockType = 3
news.Open()
news_numRows = 0
%>
<%

set updateAuth = Server.CreateObject("ADODB.Command")
updateAuth.ActiveConnection = MM_toptipsracing_STRING
updateAuth.CommandText = "UPDATE members, memberships  SET accesslvl 
= 'member',   authtodate = IIf(authtodate<date(), date() + duration, 
authtodate + duration),  netbanxref = " + Replace
(updateAuth__varNetbanxRef, "'", "''") + ",   netbanxdate = date()  WHERE 
username LIKE " + Replace(updateAuth__varUsername, "'", "''") + " AND ref 
LIKE " + Replace(updateAuth__varMembership, "'", "''") + ""
updateAuth.CommandType = 1
updateAuth.CommandTimeout = 0
updateAuth.Prepared = true
updateAuth.Execute()

%>



Please help because this is driving me crazy!

This is happening in Ultradev4 with Access2000 on Windows2000.

GP
gp@1...



  Return to Index