Trying to use ASP script to run partial SQL and write to an MDB for online inventory purposes.
Here is the code: -
-
<html>
-
<head>
-
-
<script type="text/javascript">
-
function goback()
-
{
-
history.go(-1)
-
}
-
</script>
-
-
</head>
-
-
-
<body>
-
<%
-
set conn=Server.CreateObject("ADODB.Connection")
-
conn.Provider="Microsoft.Jet.OLEDB.4.0"
-
conn.Open(Server.Mappath("/clientlogin/db/jcb.mdb"))
-
-
cid=Request.Form("sku")
-
-
-
-
-
-
if Request.form("SKU")="" then
-
set rs=Server.CreateObject("ADODB.Recordset")
-
rs.open "SELECT SKU,Style,itemnumber,Color,Quantity,Location,lastmod FROM inventory WHERE SKU='" & cid & "'", conn
-
%>
-
-
<form method="post" action="inventory_update.asp">
-
<table>
-
<%for each x in rs.Fields%>
-
<tr>
-
<td><%=x.name%></td>
-
<td><input name="<%=x.name%>" value="<%=x.value%>"></td>
-
<%next%>
-
</tr>
-
</table>
-
<br /><br />
-
<input type="submit" name="action" value="Save">
-
<input type="submit" name="action" value="Delete">
-
-
<INPUT TYPE="BUTTON" VALUE="Go Back" ONCLICK="goback()">
-
</form>
-
<%
-
elseif Request.Form("action")="Delete" then
-
sql="DELETE FROM inventory"
-
sql=sql & " WHERE sku='" & cid & "'"
-
conn.Execute sql
-
response.redirect "http://www.shipping-and-handling.com/clientlogin/jcb/update.asp"
-
-
-
else
-
sql="UPDATE inventory SET "
-
sql=sql & "style='" & Request.Form("style") & "',"
-
sql=sql & "itemnumber='" & Request.Form("itemnumber") & "',"
-
sql=sql & "color='" & Request.Form("color") & "',"
-
sql=sql & "quantity='" & Request.Form("quantity") & "',"
-
sql=sql & "location='" & Request.Form("location") & "',"
-
sql=sql & "lastmod=(date())"
-
sql=sql & " WHERE sku='" & cid & "'"
-
on error resume next
-
conn.Execute sql
-
if err<>0 then
-
response.write("A dyslexic man walks into a bra... (you're having technical issues. Call Aaron")
-
else
-
response.redirect "http://www.shipping-and-handling.com/clientlogin/jcb/update.asp"
-
end if
-
end if
-
conn.close
-
%>
-
-
-
-
</body>
-
</html>
Here is the specific line of code being referred to: - 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.
aaronsah - 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
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
Does the field SKU have a Text or Number data type?
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.
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.
zmbd 5,501
Expert Mod 4TB
aaronsah - 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
Also, although from what I've learned not always needed in Access, you are missing the terminal ";" it's best practice to use this.
zmbd 5,501
Expert Mod 4TB
just noted: - SKU,Style,itemnumber,Color,Quantity,Location,lastmod
Watch your spacing... you need to seperate the fields. - SKU, Style, itemnumber, Color, Quantity, Location, lastmod
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!
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 (^_^)
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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
|
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...
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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$) {
}
...
|
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...
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
| | |