Hi
i've got product ID Auto number in MS Access but i can't update or insert 2 values into the same database field -
<HTML><HEAD><TITLE>fds</TITLE></HEAD>
-
<BODY >
-
<%
-
Dim objrs,objConn
-
Dim xx, yy, hh, ww, tkid
-
-
tkid = Trim(Request.QueryString("ID"))
-
xx = Trim(Request.QueryString("x2"))
-
yy = Trim(Request.QueryString("y2"))
-
-
-
Set objConn = Server.CreateObject("ADODB.Connection")
-
objConn.open ConString
-
set objrs = server.createObject("ADODB.RecordSet")
-
' these 3 values should not be in the database.
-
objrs.open "select dx, dy from pix1 where ID = " & tkid & " and dx = " & xx & " and dy =" & yy &";",objConn,Adopendynamic,Adlockoptimistic
-
if objrs.eof then
-
-
objrs.Addnew
- 'tkid already into the database only these 2 value need to add ?
-
objrs("dx")=xx
-
objrs("dy")=yy
-
objrs.update
-
-
response.write" New Record save in the Database"
-
else
-
response.write" This Record already in a Database"
-
end if
-
-
objrs.close
-
set objrs= Nothing
-
objConn.Close
-
set objConn = Nothing
-
%>
-
</BODY></HTML>
-
-
-
any body know where is the problem or any body can solve this problem ?
-
3 1194
More than likely it's a data type mismatch issue. Is that the error you're getting because I can definately see that happening.
You are pulling xx and yy down from the querystring and then inserting those values into the database.
When you pull a value down from the querystring, it is a STRING data type - so if the column in your table has an integer value, for instance, and you try to put unmodified information from the querystring into it - it will throw a data type mismatch error even though the data you're pulling from the querystring might be a number, it's still considered a string by ASP at this point. Instead of being looked at as, say, 13 - it is being looked at as "13"
I recommend wrapping CINT around the following code to force it to become a number..
tkid = CINT(Trim(Request.QueryString("ID")))
xx = CINT(Trim(Request.QueryString("x2")))
yy = CINT(Trim(Request.QueryString("y2")))
Just remember that CINT will drop any decimal places your number might have.
Thanks for your kindly reply
i think so your rite that's might be this problem i'm gonna take a look 2marrow in more detail,
following my inquiry, my SQL Statement is rite ? coz i need to check 3 value compression into the database & then update the xx & yy value only with selected product ID ( tkid ) -
objrs.open "select dx, dy from pix1 where ID = " & tkid & " and dx = " & xx & " and dy =" & yy &";",objConn,Adopendynamic,Adlockoptimistic
-
objrs.open "select dx, dy from pix1 where ID = " & tkid & " and dx = " & xx & " and dy =" & yy &";",objConn,Adopendynamic,Adlockoptimistic
you have written it as if expecting that ID, dx, and dy are all numeric values. If that is the case, then yes it all looks good. If any of these are supposed to be strings or dates or any other format, then it will need to be changed.
Jared
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jason |
last post by:
Let's say I have an html form with 20 or 30 fields in it. The form
submits the fields via POST to a php page which updates a table in a
database with the $_POST vars. Which makes more sense?
...
|
by: Chris Jackson |
last post by:
I'm a novice Access user and am not sure how to solve the following problem.
Any help with the following would be greatly appreciated!
I have two tables with identical structures, the first holds...
|
by: Ray Holtz |
last post by:
I have a form that shows a single record based on a query criteria.
When I click a button it is set to use an append query to copy that
record to a separate table, then deletes the record from the...
|
by: MLH |
last post by:
I have a form, bound to a query. Its RecordSource property
is a query named frmEnterLienAmounts. The form has a few
bound controls and some unbound controls. The unbound
controls are calculated...
|
by: junglist |
last post by:
Hi guys,
I've been trying to implement an editable datagrid and i have been
succesful up to the point where i can update my datagrid row by row.
However what used to happen was that once i updated...
|
by: Winshent |
last post by:
I am having problems with adding items to my shopping cart. The problem
occures when adding items that already exists in the cart.
When a user adds to cart, they are automatically redirected to...
|
by: Hexman |
last post by:
I've come up with an error which the solution eludes me. I get the
error:
>An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in HRTest.exe
>
>Additional...
|
by: bill |
last post by:
In an application I am writing the user can define a series of
steps to be followed. I save them in a sql database using the
field "order" (a smallint) as the primary key.
(there are in the range...
|
by: aaronyoung |
last post by:
I have created custom navigation buttons and Record Number indicators on several forms that are used to review and update records based on a query.
My On Current event to update the "Record X of...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |