[thelist] ASP Question

Glen Burnett glenburnett at xtra.co.nz
Fri Oct 11 08:35:00 CDT 2002


The problem is that the order of your column names and their values are
wrong.

You are inserting the ip address into the day field which is what will be
giving you the data type mismatch error.

The sql string should look like:

sql = "INSERT INTO stuff(PostedBy,IpAddr,Day,Message) VALUES
('"&straddr&"','"&strip&"','"&strday&"','"&strmsg&"')"


Glen





-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Michael CAREY
Sent: Friday, 11 October 2002 6:42 p.m.
To: thelist at lists.evolt.org
Subject: [thelist] ASP Question


--
[ Picked text/plain from multipart/alternative ]
Hi there. I am an ASP newbie so dont bite my head off if this is a silly
mistake.

My code to do a simple db update looks like this
----------------------------------------------------------------------------
-------------------------------------------
<%
Dim objconn, strprovider, sql
Set objconn = Server.CreateObject("ADODB.Connection")
strprovider = "Driver=Microsoft Access Driver (*.mdb);
DBQ=e:\domains\elementdesign.dc-hosting.co.uk\user\htdocs\display\update.mdb
"
objconn.Open(strprovider)

'Server Side form validation to keep our database clean
straddr = request.form("PostedBy")
strmsg= request.form("Message")
strip = request.form("IpAddr")
strday = request.form("Day")


sql = "INSERT INTO stuff(PostedBy,IpAddr,Day,Message) VALUES
('"&straddr&"','"&strday&"','"&strip&"','"&strmsg&"')"

objconn.Execute(sql)


'Lets redirect the user back to where they came from
Response.Redirect "thanks.htm"
%>
----------------------------------------------------------------------------
----------------------------------------------------------------------------
--------

My database is called update with a table in it called stuff. I have four
columns
PostedBy, IpAddr, Day, Message in that order.
I have this page linked into a form, from which the results are stored.
However, I keep getting the following error

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

[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria
expression.

/display/add.asp, line 16



I really am stuck on this one. It has taken me a long time to get my
connection right but i finally have but there are still errors.



There is a test version at
www.elementdesign.dc-hosting.co.uk/display/addit.asp

Please please please help.

Thanks in advance.

Giles Carey  giles at elementdesign.biz  www.elementdesign.biz





--

--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !




More information about the thelist mailing list