Forums
This topic is locked
Command datatype
Posted 05 Nov 2007 19:02:38
1
has voted
05 Nov 2007 19:02:38 David Knowles posted:
Hi guys hope this is the correct place to post this.I am trying to follow the tutorial on chronoworks site to be able to insert into 2 tables and have ceated to commands to do it, the problem i`m having is that when i redirect to the page with the commands on i get this error message.
ADODB.Command error '800a0d5d'
Application uses a value of the wrong type for the current operation.
/vgs working/insertoutboxmessage.asp, line 82
Heres the commands :
<pre id=code><font face=courier size=2 id=code><%
Set Command1 = Server.CreateObject ("ADODB.Command"
Command1.ActiveConnection = MM_connectDB_STRING
Command1.CommandText = "INSERT INTO vgs.messages (messageSubject, message, messageTo, messageFrom) VALUES (?, ?, ?, ? )"
Command1.Parameters.Append Command1.CreateParameter("varSubject", 201, 1, 255, MM_IIF(Request.Form("subjectField", Request.Form("subjectField", Command1__varSubject & "")
Command1.Parameters.Append Command1.CreateParameter("varMessage", 201, 1, 16777215, MM_IIF(Request.Form("messageField", Request.Form("messageField", Command1__varMessage & "")
Command1.Parameters.Append Command1.CreateParameter("varTo", 5, 1, -1, MM_IIF(Request.Form("toField", Request.Form("toField", Command1__varTo & "")
Command1.Parameters.Append Command1.CreateParameter("varFrom", 5, 1, -1, MM_IIF(Request.Form("fromField", Request.Form("fromField", Command1__varFrom & "")
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()
Set Command1 = Nothing
%>
<%
Set Command2 = Server.CreateObject ("ADODB.Command"
Command2.ActiveConnection = MM_connectDB_STRING
Command2.CommandText = "INSERT INTO vgs.outbox (messageSubject, message, messageTo, messageFrom) VALUES (?, ?, ?, ? ) "
Command2.Parameters.Append Command2.CreateParameter("varSubject", 201, 1, 255, MM_IIF(Request.Form("subjectField", Request.Form("subjectField", Command2__varSubject & "")
Command2.Parameters.Append Command2.CreateParameter("varMessage", 201, 1, 16777215, MM_IIF(Request.Form("messageField", Request.Form("messageField", Command2__varMessage & "")
Command2.Parameters.Append Command2.CreateParameter("varTo", 5, 1, -1, MM_IIF(Request.Form("toField", Request.Form("toField", Command2__varTo & "")
Command2.Parameters.Append Command2.CreateParameter("varFrom", 5, 1, -1, MM_IIF(Request.Form("fromField", Request.Form("fromField", Command2__varFrom & "")
Command2.CommandType = 1
Command2.CommandTimeout = 0
Command2.Prepared = true
Command2.Execute()
Set Command2 = Nothing
%> </font id=code></pre id=code>
I have setup the datatypes to Double and the values to -1 as stated:
Type in database
Type in Dreamweaver
Size
Numeric (MS Access, MS SQL Server, MySQL)
Double
-1
Boolean, Yes/No (MS Access, MS SQL Server, MySQL)
Double
-1
Date/Time (MS Access, MS SQL Server, MySQL)
DBTimeStamp
-1
All other types of text fields, including the MySQL text data types char, varchar and longtext
LongVarChar
check database table
Text (MS Access) or nvarchar, nchar (MS SQL Server)
VarWChar
check database table
Memo (MS Access), ntext (MS SQL Server), or fields that support large amounts of text
LongVarWChar
1073741823
So checked the table in dreamweaver and it says : interger 4 required.
Could you guys please tell me what i`m doing wrong?
David Knowles
I also found this piece of code to check if the form fields are returned as numeric and they are.
<%
dim num_check, numeric_test
num_check = request.querystring("toField"
numeric_test = (isnumeric(num_check))
if (numeric_test = TRUE) Then
response.write ("It is a number"
elseif (numeric_test = FALSE) Then
response.write ("It is not a number"
end if
%>
Edited by - mrmidjam on 05 Nov 2007 19:54:49
Replies
Replied 05 Nov 2007 21:01:14
05 Nov 2007 21:01:14 David Knowles replied:
Ok I thought i would try and narrow this down a bit and changed the datatype of the mysql field from int
to varchar and changed the command to insert as varchar and it works, well it inputs the text from the
subjectField and messageField but not the numbers from toField and fromField.
So its a problem with the int datatype so tried some of the other types Double, interger but still same error
message.
David Knowles
to varchar and changed the command to insert as varchar and it works, well it inputs the text from the
subjectField and messageField but not the numbers from toField and fromField.
So its a problem with the int datatype so tried some of the other types Double, interger but still same error
message.
David Knowles
Replied 05 Nov 2007 23:09:17
05 Nov 2007 23:09:17 David Knowles replied:
Did some more testing, don`t know what i`m doing really but i`m persistant.
I changed the Command1__varTo & "") portion of the code to Request("toField" and i didn`t get the error
but the fields where not updated in the message and subject but got some random numbers in the to and
from field "finally some numbers there woohoooo".
Just thought it may help.
David Knowles
I changed the Command1__varTo & "") portion of the code to Request("toField" and i didn`t get the error
but the fields where not updated in the message and subject but got some random numbers in the to and
from field "finally some numbers there woohoooo".
Just thought it may help.
David Knowles