|
-
Mar 16th, 2004, 08:12 AM
#1
Thread Starter
Addicted Member
UPDATE problem
I'm trying a simple update
Code:
sub Opslaan_Click (s as object , e as eventargs)
dim CON as odbcconnection
dim CMD as odbccommand
dim DTR as odbcdatareader
dim STR_INSERT, STR_UPDATE as string
dim ID_type, ID_stock, ID_leverancier as integer
CON = new odbcconnection("DSN=STOCK")
CON.open
STR_INSERT = "INSERT INTO producten (pro_type, pro_productnaam, pro_product, pro_producent, pro_leverancier, pro_stockeerplaats, pro_pcsunit, pro_size, pro_weight, pro_minimum, pro_opmerking) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
STR_UPDATE = "UPDATE Producten SET pro_type = ?, pro_productnaam = ?, pro_product = ?, pro_producent = ?, pro_leverancier = ?, pro_stockeerplaats = ?, pro_pcsunit = ?, pro_size = ?, Pro_weight = ?, pro_minimum = ?, pro_opmerking = ? WHERE pro_id = ?"
response.write(id_product)
if request.querystring("id") = ""
CMD = New odbcCommand(STR_INSERT, CON)
else
CMD = New odbcCommand(STR_UPDATE, CON)
end if
CMD.parameters.add ("@type", ID_type)
CMD.parameters.add ("@productnaam", "HELLOOOOOOOOOw") 'this field DOES update -> hardcoded
CMD.parameters.add ("@product", txtproduct.text)
CMD.parameters.add ("@producent", txtproducent.text)
CMD.parameters.add ("@leverancier", ID_leverancier)
CMD.parameters.add ("@stockeerplaats", ID_stock)
CMD.parameters.add ("@pcs", txtpcsunit.text)
CMD.parameters.add ("@weight", txtweight.text)
CMD.parameters.add ("@size", txtsize.text)
CMD.parameters.add ("@minimum", txtminimum.text)
CMD.parameters.add ("@opmerking", txtopmerking.text)
if not request.querystring("id") = ""
CMD.parameters.add ("@id", id_product)
end if
CMD.ExecuteNonQuery()
CON.close
end sub
there are no errors, but the fields in my database are not updated...except for the one hardcoded "HELLOOOOOOOOOw"
Can i check the SQL-statement that is generated by the program somewhere?
I must be missing something...
never argue with an idiot, he will bring you down to his level and will beat you through experience
-
Mar 16th, 2004, 08:27 AM
#2
Thread Starter
Addicted Member
other helpfull tips or remarks on my code are welcome too!!!
never argue with an idiot, he will bring you down to his level and will beat you through experience
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|