Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type Mismatch?

Status
Not open for further replies.

lynque

IS-IT--Management
Sep 30, 2004
124
CA
Hello All,

I am stumped on this one...

I have one version of this update query that works
Code:
set rsPutItemOrder = Server.CreateObject("ADODB.Recordset")
			rsPutItemOrder.Open "itemsOrdered", Conn, adOpenStatic, adLockOptimistic, adCmdTable
			
			rsPutItemOrder.addnew
			rsPutItemOrder("orderID") = Request.form("intOrderID")
			rsPutItemOrder ("quantity") = Request.Form("intQuant")
			rsPutItemOrder ("productID") = Request.Form("intStock")

Once I add to it a little, I get the oh so descriptive "type mismatch" error for ("intStock").

Code:
set rsPutItemOrder = Server.CreateObject("ADODB.Recordset")
    		rsPutItemOrder.Open "itemsOrdered", Conn, adOpenStatic, adLockOptimistic, adCmdTable
			
			rsPutItemOrder.addnew
			rsPutItemOrder("orderID") = Request.form("intOrderID")
			rsPutItemOrder("productDesc") = Request.form("strProdName")
			rsPutItemOrder ("productID") = Request.Form("intStock")
			rsPutItemOrder("itemPrice") = Request.form("intPrice")
			rsPutItemOrder("beforeTax") = Request.form("intExtPrice")

I think what is throwing me is that it did work???

Any suggestions?
 
First guess is that something is empty and nulls are not allowed.

Second guess is that something numeric and it is getting a
string representation of a number that it can't convert automatically. What I'm trying to say is that there is a difference between the value of, say 5 and the character "5" and sometimes this makes a type mismatch.

So the question is, what are the data types of the target fields and do they allow nulls?
 
Thanks Sheco,

the data type is "number"(long int) and the field does allow nulls.
 
Well you might try using the function to convert a value to a long... that way if it is empty it will get converted to zero.

rsPutItemOrder("productID") = cLng(Request.Form("intStock"))

Also, I took out the extra space...
 
Thanks again for your help,
Tried that and it threw this error...

Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'cLng'
 
your really shouldn't open a recordset to insert a new record
 
OK if you are also getting a type mismatch with cLng then that kinda answers the question.

Whatever it is that you are trying to insert cannot be converted to a long.

Also, steven is write, it would be much better for you to build an INSERT statment and then call the .Execute() method of your ADO connection object.
 
OK if you are also getting a type mismatch with cLng then that kinda answers the question.

Whatever it is that you are trying to insert cannot be converted to a long.

Also, steven is right, it would be much better for you to build an INSERT statment and then call the .Execute() method of your ADO connection object.
 
crud, I tryed to stop it before it submitted so that I could change the spelling of write to right but it looks like both went through, oh well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top