Forums

This topic is locked

Stored Procedures Help Needed

Posted 20 Aug 2002 22:45:04
1
has voted
20 Aug 2002 22:45:04 Dave Thomas posted:
Lo all <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

After following the Tutorial on here that Waldo posted up on "Using Stored Procedures in MS Access" I've ran into a problem.

I've got a simple Table called "IPs" with fields "ID", "IPAddress" & "DateAdded"
With an Insert Query called "NewIP"

The query works fine in Access, I just can't get it to work in UDev.

<b>Error im getting is:</b>
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

Microsoft ODBC Microsoft Access Driver Syntax error in INSERT INTO statement.

/stored/storedproc.asp, line 17

<b>What I'm aiming to do is:</b>
Simply set up a simple Access DB to store IP's of visitors to a web page, so I can build a simple stats program.

<b> The Code which UD generates is:</b>
&lt;%@LANGUAGE="VBSCRIPT"%&gt;
&lt;!--#include file="Connections/myStoredProc.asp" --&gt;
&lt;%

if(Request.ServerVariables("REMOTE_ADDR" &lt;&gt; "" then myCommand__varIP = Request.ServerVariables("REMOTE_ADDR"

%&gt;
&lt;%

set myCommand = Server.CreateObject("ADODB.Command"
myCommand.ActiveConnection = MM_myStoredProc_STRING
myCommand.CommandText = "INSERT INTO (IPs ) VALUES (IPAddress ) WHERE IPAddress = "" + Replace(myCommand__varIP, "'", "''" + """
myCommand.CommandType = 1
myCommand.CommandTimeout = 0
myCommand.Prepared = true
myCommand.Execute()

%&gt;
This is using the "Command / Stored Procedure" function.

<b>and this... is the SQL for the command</b>
INSERT INTO (IPs)
VALUES ((IPAddress ) WHERE IPAddress = varIP)

and then varIP has a runtime value of "Request.ServerVariables("REMOTE_ADDR""

There may be an easier way to do this but i really want to learn how to do it with a Stored Procedure, but any input is welcomed.



Regards,
Dave

UD4 || Flash || Access ||Web Hosting

Reply to this topic