[Resolved] Can ADD and DELETE from mDB but not UPDATE..?!?!
This is the code i use to UPDATE within my page.. but it doesnt update anything, it doesnt do anything, nor doest it trow any errors..
Can someone look over my code (i'll upload the ASP page,and the mdb)
(PS: the DB was renamed to .txt , because the upload system here doesnt accept .mdb as extension...dunno why??)
Here's the code that create's the "problem" (it doesnt update the DB)
Re: Can ADD and DELETE from mDB but not UPDATE..?!?!
Hi,
If its not thortwing any errors at alll and the code is not updating or transacting to teh MDB, then it is probably the connectionstring or the connection itself is not executing at all, therefore not executing the statement. check the following.
1. any case or boolean ilogical statements that may be in operation to trigger the instance off, they may be not triggereing, the string literals may be incorrect, or a naming convention could be at fault.
2. If in the event that your connection string is in a function or class, make sure that the class is properly instantiated or initialised when needed or prompted by your application.
3. Check any execution statements that triggers the query off such as your recordset or your connection object, they may be at fault or not instantiating properly.
Check these points and get back to me.
Hope this helps
Kai
As the information I give is useful in its nature, consider using the RATE POST feature located on the bottom left of this post please..
A few things that make a good Developer a Great One. Methodical and a thorough approach to research and design inevitably leads to success. Forward thinking is the key to Flow of control. Never test in the design environment, always test in real time, you get the REAL results. CBSE & OOSE are the same animal, they just require different techniques, and thinking. SEO is a globe of objectives, SE rankings is an end to a means for these objectives, not part of them. The key to good design is explicit attention to both detail and response. Think Freely out of the "Box" you're in..... You will soar to better heights.
Re: Can ADD and DELETE from mDB but not UPDATE..?!?!
Well.. my connection and all is OK.. but now that i changed some stuff, it trows me an error
See below code that should do the UPDATE..
(or download the DB from the prev post + the ASP in this post...and try yourself)
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntakserror in UPDATE-string
/ASPnettbutikk/butikk.asp, linje 127
VB Code:
'If the QueryString has the Actionvar = update then generate
'the page for updating items
ELSEIF Actionvar="update" THEN
IF Len(TRIM(Request.Form("flag"))) = 0 THEN
SQLstmt = "SELECT * FROM Produkter WHERE ID=" & Request.QueryString("Recid")
As you can see, ive made some changes to your statement.
1. the WHERE_ID never use spaces in your tables at all. So change this for what ive substituted adn youre away.
2. Plus you missed some single quotes out and I have added them...
try this and see how you get on.
Kai
Last edited by kaihirst; Dec 12th, 2005 at 01:15 PM.
As the information I give is useful in its nature, consider using the RATE POST feature located on the bottom left of this post please..
A few things that make a good Developer a Great One. Methodical and a thorough approach to research and design inevitably leads to success. Forward thinking is the key to Flow of control. Never test in the design environment, always test in real time, you get the REAL results. CBSE & OOSE are the same animal, they just require different techniques, and thinking. SEO is a globe of objectives, SE rankings is an end to a means for these objectives, not part of them. The key to good design is explicit attention to both detail and response. Think Freely out of the "Box" you're in..... You will soar to better heights.
Re: Can ADD and DELETE from mDB but not UPDATE..?!?!
I get a new error here..
Feiltype:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] For få parametere. Ventet 1.
/ASPnettbutikk/butikk.asp, linje 137 (too few parameters. expected 1)
*************** Please use [highlight=vb]..your code.. [/highlight] when posting code!
When you have received the working answer to your question,
please mark it as *SOLVED* + Your Questions Title ...using your Thread's Tool menu.
Also try to point out what answer made it work for you, or edit your first post to contain a quote of the correct answer...
Please Answer All Questions With Working Code Examples...
As you can see, ive made some changes to your statement.
1. the WHERE_ID never use spaces in your tables at all. So change this for what ive substituted adn youre away.
2. Plus you missed some single quotes out and I have added them...
try this and see how you get on.
Kai
Slow down there trigger....
The WHERE ID wasn't a FIELD name.... it was his WHERE clause. WHERE ID = 12.
Assuming ID is in fact a number, the lack of quotes on it is correct.
OKay... but we are getting somewhere.... Even though you've specified the table to be updated in the UPDATE clause, because you are using a WHERE clause, you have to specify the FROM caluse as well.... as silly as it seems, it should be done.
SQLstmt = SQLstmt & "Varetekst='" & TRIM(Request.Form("Varetekst")) & "', " <-- see this comma right here? It shouldn't be there. Dump it.
SQLstmt = SQLstmt & " WHERE ID=" & TRIM(Request.Form("Recordid"))
I didn't see that until I was pasting your code it... then it stood out.... The last coma after the last field being updated is not needed as there are no more fields listed after it.
Re: Can ADD and DELETE from mDB but not UPDATE..?!?!
ARRGGGHH didnt look hard enough at the query!! Cheers Tech....
Teaches me for spending 10 hours coding in the office then come straight home NOT via the pub and stright on the coding forums!!!
NOTE TO SELF.. GET LIFE!!!!!
Kai
As the information I give is useful in its nature, consider using the RATE POST feature located on the bottom left of this post please..
A few things that make a good Developer a Great One. Methodical and a thorough approach to research and design inevitably leads to success. Forward thinking is the key to Flow of control. Never test in the design environment, always test in real time, you get the REAL results. CBSE & OOSE are the same animal, they just require different techniques, and thinking. SEO is a globe of objectives, SE rankings is an end to a means for these objectives, not part of them. The key to good design is explicit attention to both detail and response. Think Freely out of the "Box" you're in..... You will soar to better heights.