Link to home
Start Free TrialLog in
Avatar of fird
fird

asked on

Error Type: Microsoft JET Database Engine (0x80040E07) Data type mismatch in criteria expression.

Error Type:
Microsoft JET Database Engine (0x80040E07)
Data type mismatch in criteria expression.
/vms/save_edited_vendor.asp, line 30

got this error when i run the system. i think it is because the company_id is integer. i don't know the format for integer in ASP. the code are as follows:
------------------

<%
'declare variables
Dim Conn,DSN,rs,strsql
company_id=session("company_id")

company_name= Request.Form("companyname_text")
address= Request.Form("address_text")
postcode= Request.Form("postcode_text")
city= Request.Form("city_text")
state= Request.Form("state_list")
phone= Request.Form("phone_text")
fax= Request.Form("fax_text")
email= Request.Form("email_text")
website= Request.Form("website_text")
            
            Set Conn=Server.CreateObject("ADODB.Connection")
            Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db/db1.mdb")            
            Set SQL= Server.CreateObject("ADODB.Recordset")
            SQL.Open "SELECT * From vendor WHERE company_id='"&company_id&"'",Conn,2,2 <--- line 30
                        
            SQL("company_name")=company_name
        SQL("address")=address
        SQL("postcode")=postcode
            SQL("city")=city
            SQL("state")=state
            SQL("phone")=phone
            SQL("fax")=fax
            SQL("email")=email
            SQL("website")=website
            SQL.Update
Conn.Close
Set Conn = Nothing      
%>

-----------------------

Thanks & Regards
SOLUTION
Avatar of hongjun
hongjun
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You do not need a quote for integer
Avatar of fird
fird

ASKER

thanks but i got this error when i ignore the quote:

Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression 'company_id='.
/vms/save_edited_vendor.asp, line 30
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
for more information regarding your error try to check out the link might help...

http://www.adopenstatic.com/faq/80040e10.asp

Happy programming
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fird

ASKER

I tried ur solution but the page display this

SELECT * From vendor WHERE company_id=


if i use this company_id=session("company_id") does it means i display the value of company_id?

thanks 4 ur time
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
BTW is the problem not solve yet... I saw that you already close a question similar to this which is posted by hongjun on anothe link.

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It  seems that you have forgot to set the Session("company_id") in a previous page or your session must have timedout when running/executing this page.


Pls make sure that you assign the company_id to Session("company_id") where necessary in your site before coming to this page.

Also just for the record, the SQL server implicitly converts character/string data to integer ... so even if you have the single quote in your sql statement, it will still work provided you have assigned the company_id to the Session("company_id").
Avatar of fird

ASKER

thanks hongjun, gladxml, babuno & randeeps. I forgot to set the session("company_id") in the previous page. but i still got a problem in the same coding after i set the session in the previous page. the coding seems like working successfully but when i check the database, all fields are empty except the company_id(primary key). thanks again for ur help guys!
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fird

ASKER

thanks guys for ur help. appreciated!