HighDots Forums  

Type mismatch - Provider (0x80020005)

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Type mismatch - Provider (0x80020005) in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jamesm
 
Posts: n/a

Default Type mismatch - Provider (0x80020005) - 08-03-2004 , 12:01 PM






Hi,

I am using CharonCart3 and On the product_insert.asp page there is a section
of code (part of which is below) which inserts the new product:

<%
if AccessGroupID <> 2 then
if Request("selected") <> "" then
ProductsRS.AddNew
ProductsRS("Product")=Request("Product")
ProductsRS("Description")=Request("Description")
ProductsRS("CategoryID")=Request("CategoryID")
ProductsRS("ManufacturerID")=Request("Manufacturer ID")
ProductsRS("Price")=Request("Price")
ProductsRS("InStock")=DoNull(Request("InStock"))
ProductsRS("starbuy")=Request("starbuy")

The last line is a line I have added myself because I wish to put a checkbox
on the page called 'starbuy' which will insert/update a field called 'starbuy'
in the access database.

However whenever the page is submitted it prdouces the following error:
Provider (0x80020005)Type mismatch.

Anyone got any ideas as to what code I should use, I am very much a novice.

Thanks


Reply With Quote
  #2  
Old   
Les Matthews
 
Posts: n/a

Default Re: Type mismatch - Provider (0x80020005) - 08-03-2004 , 12:16 PM






What data type is the field "starbuy" (i.e. text, number, date, bit or
yes/no)? What type of data are you submitting in the form on your page?

"jamesm" <webforumsuser (AT) macromedia (DOT) com> wrote

Quote:
Hi,

I am using CharonCart3 and On the product_insert.asp page there is a
section
of code (part of which is below) which inserts the new product:

%
if AccessGroupID <> 2 then
if Request("selected") <> "" then
ProductsRS.AddNew
ProductsRS("Product")=Request("Product")
ProductsRS("Description")=Request("Description")
ProductsRS("CategoryID")=Request("CategoryID")
ProductsRS("ManufacturerID")=Request("Manufacturer ID")
ProductsRS("Price")=Request("Price")
ProductsRS("InStock")=DoNull(Request("InStock"))
ProductsRS("starbuy")=Request("starbuy")

The last line is a line I have added myself because I wish to put a
checkbox
on the page called 'starbuy' which will insert/update a field called
'starbuy'
in the access database.

However whenever the page is submitted it prdouces the following error:
Provider (0x80020005)Type mismatch.

Anyone got any ideas as to what code I should use, I am very much a
novice.

Thanks




Reply With Quote
  #3  
Old   
jamesm
 
Posts: n/a

Default Re: Type mismatch - Provider (0x80020005) - 08-04-2004 , 09:05 AM



Hi Les,

Thanks for the reply. I want the form to insert into an access database and
most of the form consists of standard text fields but I have one checkbox which
inserts into a field called 'starbuy' with a 'yes/no' datatpye.

Thanks for any help


Reply With Quote
  #4  
Old   
cmbergin
 
Posts: n/a

Default Re: Type mismatch - Provider (0x80020005) - 08-04-2004 , 10:50 AM



That's because a checkbox only has a value when checked. If your checkbox
value is, say "checkbox", then that's what it returns when it's checked.

<input name="myCheck" type="checkbox" value="test">
When checked:
Request.Form("myCheck") == "test"
When not checked:
Request.Form("myCheck") == ""

SO - make sure the value of the checkbox is 1, then use
CInt(Request.Form("starbuy")). CInt will convert "" to 0. This assumes that
Access uses 1/0 for yes/no. If not, then just do your own test on "starbuy"
and substitute the appropriate values. (It might be -1/0, for instance)


Reply With Quote
  #5  
Old   
Les Matthews
 
Posts: n/a

Default Re: Type mismatch - Provider (0x80020005) - 08-04-2004 , 10:56 AM



The value of the checkbox are "-1" or "0" - correct?

"jamesm" <webforumsuser (AT) macromedia (DOT) com> wrote

Quote:
Hi Les,

Thanks for the reply. I want the form to insert into an access database
and
most of the form consists of standard text fields but I have one checkbox
which
inserts into a field called 'starbuy' with a 'yes/no' datatpye.

Thanks for any help




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.