Ask a Question related to ASP Database, Design and Development.
-
Me #1
Data type mismatch error assistance please
Hi.
Winxp/iis5/dwmx/asp/vb/msaccess
I'm trying to update a record based on a cookie existance.
I'm getting this error when trying to load the page
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria
expression.
/affiliates/set.asp, line 19
I've tripple checked the data types in the database and can't see anything
wrong.
The field is a simple hit counter and is set to number/long integer
The code for the hit counter is as follows
<%
IF Request.Querystring("Affid") <> "" THEN
Response.Cookies("Affidcookie") = Request.Querystring("Affid")
Response.Cookies("Affidcookie").Expires = Date + 30
END IF
%>
<%
if(request.querystring("affid") <> "") then Command1__varid =
request.querystring("affid")
IF NOT Request.Querystring("Affid") = "" THEN
set Command1 = Server.CreateObject("ADODB.Command")
Command1.ActiveConnection = MM_conn222_STRING
Command1.CommandText = "UPDATE affiliates SET hits = hits + 1 WHERE Affid
= '" + Replace(Command1__varid, "'", "''") + "'"
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute() 'this is line 19
END IF
%>
Can anyone shed some light on this for me i'm stumped.
Dan
Me Guest
-
Type mismatch error
This query works fine on a live server using an MSSQL database: <cfquery name="qIndex" datasource="#appDSN#" username="shampoo"... -
Access data type mismatch for empty form field
Hello Everyone; I'm using an MS Access DB on a CFMX (CF 6) site...and updating records in a db from a form ..the CFM for code looks like : ... -
data type mismatch error...
HI guys, getting pretty stressed with this haha! it's probably something simple...right I have this registration form that does multiple checks... -
Data type mismatch in criteria expression
the Access database data typs for the 'active' and 'officer' fields are datatype Yes/No ---------------------------------------EmTiDOHActOff.cfm... -
Type mismatch Session error
You'll need to post a snippet of relevant code. Ray at work "TD" <TurboDuster@noyahoospam.com> wrote in message... -
Me #2
Re: Data type mismatch error assistance please
Sorted it
I just spotted the fault 2 minutes after posting.
Thanks anyway
Dan
"Me" <co.uk> wrote in message
news:phx.gbl...
Affid
Me Guest
-
Bob #3
Re: Data type mismatch error assistance please
Me wrote:
The only way to debug this is to see the actual query being sent to the
database:
Response.Write Command1.commandText
Response.end
What you see in the browser window when you run this page should be a valid
sql statement that can be run without modification 9unless wildcards are
involved) when you paste it into the SQL View of the Access Query Builder. A
good exercise would be to create this query yourself using the query
builder's gui (Design View), verify that it does what you want, then switch
to SQL View to see what you need to make the sql statement look like when
you execute it from ASP.
Incidently, you are going to too much trouble to execute this statement: you
are using dynamic sql (which is not really recommended, but ... ), not
passing parameters, so you do not need an explicit Command object. A simple:
Dim sSQL, cn
sSQL= "UPDATE affiliates SET hits = hits + 1 WHERE Affid
= '" + Replace(Command1__varid, "'", "''") + "'"
'for debugging:
response.write sSQL
Set cn=server.createobject("adodb.connection")
cn.open MM_conn222_STRING
cn.execute sSQL,,129
'129 tells ADO that
'1. you are running a sql statement passed as text, and
'2. that the query being run does not return records so there is no
'need for ADO to create a recordset object
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Guest
-
Me #4
Re: Data type mismatch error assistance please
Hi Bob,
Thanks for your expert view.
I'm a novice using Dreamweaver to write the code. Can you recommend a good
tutorial on asp/vbscript or should I forget that and learn dot.net c#
What do you think is the best way forward are more people moving over to
dot.net
Regards
Dan
"Bob Barrows [MVP]" <SPAMcom> wrote in message
news:phx.gbl...
>
> The only way to debug this is to see the actual query being sent to the
> database:
>
> Response.Write Command1.commandText
> Response.end
>
> What you see in the browser window when you run this page should be a[/ref]
valid
A
switch
you
simple:
Me Guest
-
Bob #5
Re: Data type mismatch error assistance please
Many people woulod suggest skipping to dotnet now instead of learning the
defunct technology. I would look for inexpensive courses in your area
because programming in .Net requires a more comprehensive programming
foundation than vbscript.
Bob Barrows
Me wrote:
>>
>> The only way to debug this is to see the actual query being sent to
>> the database:
>>
>> Response.Write Command1.commandText
>> Response.end
>>
>> What you see in the browser window when you run this page should be
>> a valid sql statement that can be run without modification 9unless
>> wildcards are involved) when you paste it into the SQL View of the
>> Access Query Builder. A good exercise would be to create this query
>> yourself using the query builder's gui (Design View), verify that it
>> does what you want, then switch to SQL View to see what you need to
>> make the sql statement look like when you execute it from ASP.
>>
>> Incidently, you are going to too much trouble to execute this
>> statement: you are using dynamic sql (which is not really
>> recommended, but ... ), not passing parameters, so you do not need
>> an explicit Command object. A simple:
>>
>> Dim sSQL, cn
>> sSQL= "UPDATE affiliates SET hits = hits + 1 WHERE Affid
>> = '" + Replace(Command1__varid, "'", "''") + "'"
>> 'for debugging:
>> response.write sSQL
>>
>> Set cn=server.createobject("adodb.connection")
>> cn.open MM_conn222_STRING
>> cn.execute sSQL,,129
>> '129 tells ADO that
>> '1. you are running a sql statement passed as text, and
>> '2. that the query being run does not return records so there is no
>> 'need for ADO to create a recordset object
>>
>> Bob Barrows
>> --
>> Microsoft MVP - ASP/ASP.NET
>> Please reply to the newsgroup. This email account is my spam trap so
>> I don't check it very often. If you must reply off-line, then remove
>> the "NO SPAM"[/ref][/ref]
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Guest
-
John #6
Re: Data type mismatch error assistance please
Is the affid field Numeric or text field ?
John Guest
-
John #7
Re: Data type mismatch error assistance please
see www.w3schools.com/asp for on-line help
John Guest



Reply With Quote

