473,385 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Attempting to use ASP and SQL to update to MDB via webpage, running into "80040e07 da

Trying to use ASP script to run partial SQL and write to an MDB for online inventory purposes.

Here is the code:
Expand|Select|Wrap|Line Numbers
  1.  
  2. <html>
  3. <head>
  4.  
  5. <script type="text/javascript">
  6. function goback()
  7. {
  8. history.go(-1)
  9. }
  10. </script>
  11.  
  12. </head>
  13.  
  14.  
  15. <body>
  16. <%
  17. set conn=Server.CreateObject("ADODB.Connection")
  18. conn.Provider="Microsoft.Jet.OLEDB.4.0"
  19. conn.Open(Server.Mappath("/clientlogin/db/jcb.mdb"))
  20.  
  21. cid=Request.Form("sku")
  22.  
  23.  
  24.  
  25.  
  26.  
  27.   if Request.form("SKU")="" then
  28.   set rs=Server.CreateObject("ADODB.Recordset")
  29.   rs.open "SELECT SKU,Style,itemnumber,Color,Quantity,Location,lastmod  FROM inventory WHERE SKU='" & cid & "'", conn
  30.   %>
  31.  
  32.   <form method="post" action="inventory_update.asp">
  33.   <table>
  34.   <%for each x in rs.Fields%>
  35.   <tr>
  36.   <td><%=x.name%></td>
  37.   <td><input name="<%=x.name%>" value="<%=x.value%>"></td>
  38.   <%next%>
  39.   </tr>
  40.   </table>
  41.   <br /><br />
  42.   <input type="submit" name="action" value="Save">
  43. <input type="submit" name="action" value="Delete">
  44.  
  45.   <INPUT TYPE="BUTTON" VALUE="Go Back" ONCLICK="goback()">
  46.   </form>
  47. <%
  48. elseif Request.Form("action")="Delete" then
  49.   sql="DELETE FROM inventory"
  50.   sql=sql & " WHERE sku='" & cid & "'"
  51.   conn.Execute sql
  52.   response.redirect "http://www.shipping-and-handling.com/clientlogin/jcb/update.asp"
  53.  
  54.  
  55. else
  56.   sql="UPDATE inventory SET "
  57.   sql=sql & "style='" & Request.Form("style") & "',"
  58.   sql=sql & "itemnumber='" & Request.Form("itemnumber") & "',"
  59.   sql=sql & "color='" & Request.Form("color") & "',"
  60.   sql=sql & "quantity='" & Request.Form("quantity") & "',"
  61.   sql=sql & "location='" & Request.Form("location") & "',"
  62.   sql=sql & "lastmod=(date())"
  63.   sql=sql & " WHERE sku='" & cid & "'"
  64.   on error resume next
  65.   conn.Execute sql
  66.   if err<>0 then
  67.     response.write("A dyslexic man walks into a bra... (you're having technical issues. Call Aaron")
  68.   else
  69.     response.redirect "http://www.shipping-and-handling.com/clientlogin/jcb/update.asp"
  70.   end if
  71. end if
  72. conn.close
  73. %>
  74.  
  75.  
  76.  
  77. </body>
  78. </html>
Here is the specific line of code being referred to:
Expand|Select|Wrap|Line Numbers
  1. rs.open "SELECT SKU,Style,itemnumber,Color,Quantity,Location,lastmod  FROM inventory WHERE SKU='" & cid & "'", conn
Attempting to write to a database for inventory purposes. Checked and ensured all strings are correct in the database.

Throwing the error, "80040e07 data type mismatch in criteria expression"

Any help would be greatly appreciated.
Feb 26 '14 #1

✓ answered by zmbd

aaronsah
Expand|Select|Wrap|Line Numbers
  1. WHERE SKU='" & cid & "'",
aaronsah
The SKU field is numeric, because for my purposes it is 1-290-something. An alphanumeric field for item number is in the field, "itemnumber" which is set as short text.


So it is a text field if it has dashes in it and you are enclosing it within the single quote.

if is is truely numeric then remove the quotes
Expand|Select|Wrap|Line Numbers
  1. WHERE SKU=" & cid & ";"
Also, although from what I've learned not always needed in Access, you are missing the terminal ";" it's best practice to use this.

7 1512
Seth Schrock
2,965 Expert 2GB
Does the field SKU have a Text or Number data type?
Feb 26 '14 #2
The SKU field is numeric, because for my purposes it is 1-290-something. An alphanumeric field for item number is in the field, "itemnumber" which is set as short text.
Feb 26 '14 #3
I am no longer encountering the aforementioned 80040e07 error, but rather the error message that I wrote. Progress was made but I am not sure what I have yet to fix.
Feb 26 '14 #4
zmbd
5,501 Expert Mod 4TB
aaronsah
Expand|Select|Wrap|Line Numbers
  1. WHERE SKU='" & cid & "'",
aaronsah
The SKU field is numeric, because for my purposes it is 1-290-something. An alphanumeric field for item number is in the field, "itemnumber" which is set as short text.


So it is a text field if it has dashes in it and you are enclosing it within the single quote.

if is is truely numeric then remove the quotes
Expand|Select|Wrap|Line Numbers
  1. WHERE SKU=" & cid & ";"
Also, although from what I've learned not always needed in Access, you are missing the terminal ";" it's best practice to use this.
Feb 26 '14 #5
zmbd
5,501 Expert Mod 4TB
just noted:
Expand|Select|Wrap|Line Numbers
  1. SKU,Style,itemnumber,Color,Quantity,Location,lastmod  
Watch your spacing... you need to seperate the fields.
Expand|Select|Wrap|Line Numbers
  1. SKU, Style, itemnumber, Color, Quantity, Location, lastmod 
Feb 26 '14 #6
I have made the corrections listed - thanks. Still running into an error message, but it's my error (near bottom of code). Not sure what the deal is... but I am continuing to test!
Feb 27 '14 #7
zmbd
5,501 Expert Mod 4TB
You're most welcome.
Please post your new error in a new thread, you can include a link to this thread if needed for context (^_^)
Feb 27 '14 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Reply-to-group Thx | last post by:
Need to update col dated in tbl po_history from col date_expense in tbl po_expenses. Have tried, back ticks, single quotes, no quotes, etc. left join and no join. No joy. Results is consistent...
1
by: GeneSZ | last post by:
How to dynamically and partially Update the webpage? The content of the part of the page is from the user's requerement and get data from the server side. The purpose is to speed up the page...
1
by: Chris Michael | last post by:
I've only just started using update queries and have a problem with the following query in that it comes back with this error: "Subquery returned more than 1 value. This is not permitted when the...
2
by: Alex | last post by:
Hi all, I'm still running my DB2 database on RH 7.2 boxes and I'd really like to get the OS upgrade to the latest release. Anyone know what the situation is re runniong 8.1 on the latest Red Hat...
1
by: Ruslan Shlain | last post by:
Not sure who to ask about this so, I have an app that grabs data from flat file and populates a dataset with it. Then using update method of a DataAdapter I insert all that data in to the SQL...
22
by: pbd22 | last post by:
hi. I am having probelms with an update statement. every time i run it, "every" row updates, not just the one(s) intended. so, here is what i have. i have tried this with both AND and OR and...
5
by: Kosmos | last post by:
Good morning fellow programmers. Just a quick question I hope... I'm trying to run some SQL from VBA and I'm getting an error....I think it's Syntax? This is the code: Dim stSQL2
6
by: tgmcnaughton | last post by:
I have a javascript running on a page hosted by googlepages at: http://tgmcnaughton.googlepages.com/map2.htm It uses the google map api to draw a map and plot a marker at a particular latitude and...
4
by: dougans | last post by:
Hey there people, Need help on this one if you can spare me a second!!! No idea why, been trying for 2 hours to fix this now and I feel like a complete loser haha. Anyone have any idea why...
2
by: neogazz | last post by:
I have designed a webpage using XHTML, CSS and JavaScript. When I open this webpage on my computer I get the following message "Internet Explorer restricts this webpage running of a script or Active...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.