| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi there,
Please could someone help me out with this problem I am experiencing : I seem to getting this error when I go to update data in a database via a form : Type mismatch Cint and it occurs spcecifically on the following piece of code (the line it specifically referrs to is the first line...) sql10 = "UPDATE Anuncios SET CodPais=" & co & ",CodProvincia=" & pr & ",CodCP=" & fcp & ",Poblacion='" & fpob & _ "',Opcion='" & op & "',Tipo=" & ti & ",Precio='" & fpre & "',Moneda='" & fmon & "',Habitaciones=" & fhab & ",Superficie=" & fsup & _ ",Banyos=" & fban & ",Aseos=" & fase & ",Antiguedad=" & fan & ",SuperficieHab='" & fshab & "',Garaje=" & fgar & ",Ascensor=" & fasc & _ ",Trastero=" & ftra & ",Calefacción=" & fcal & ",Aire=" & fair & ",Amueblado=" & famu & ",Terraza=" & fter & ", Cocina=" & fcoc & ",Piscina=" & fpis & ",Chimenea=" & fchi & _ ",CodIdiomaA='" & fida & "',DescripcionA='" & fdea & "',CodIdiomaB='" & fidb & "',DescripcionB='" & fdeb & "',RutaImagen1='" & fimg1 & _ "',RutaImagen2='" & fimg2 & "',RutaImagen3='" & fimg3 & "' WHERE ID=" & CInt(idanun) To explain a little this code is on a form page where a client may update the information in a database via this form. If I simply update textboxes radio check boxes, this updates fine. It is when i go to update an uploaded image, which all works fine, I can go to the upload page, and it all uploads fine, and displays in the page fine, it is just when i hit accept to update the information in the database, it then hits the error. Like I say ONLY when an image has been updated. These are the variables relating to the image location info : RutaImagen1='" & fimg1 & _ "',RutaImagen2='" & fimg2 & "',RutaImagen3='" & fimg3 & I would be ever so grateful for ANY help you can offer me on this... its driving me maddd!! Thanks ) |
|
#2
|
||||
|
||||
|
If ID is a number, then just do this.
Code:
WHERE ID=" & idanun |
|
#3
|
|||
|
|||
|
Still needing help....
Hello,
awww no i am afraid that didnt work, altho it has changed the error message, it now says : Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '='. /dev/immo-actualizanun.asp, line 897 Applied to the same code as before (below) - Line 897 now referring to the last line : conex10.Execute(sql10) sql10 = "UPDATE Anuncios SET CodPais=" & co & ",CodProvincia=" & pr & ",CodCP=" & fcp & ",Poblacion='" & fpob & _ "',Opcion='" & op & "',Tipo=" & ti & ",Precio='" & fpre & "',Moneda='" & fmon & "',Habitaciones=" & fhab & ",Superficie=" & fsup & _ ",Banyos=" & fban & ",Aseos=" & fase & ",Antiguedad=" & fan & ",SuperficieHab='" & fshab & "',Garaje=" & fgar & ",Ascensor=" & fasc & _ ",Trastero=" & ftra & ",Calefacción=" & fcal & ",Aire=" & fair & ",Amueblado=" & famu & ",Terraza=" & fter & ", Cocina=" & fcoc & ",Piscina=" & fpis & ",Chimenea=" & fchi & _ ",CodIdiomaA='" & fida & "',DescripcionA='" & fdea & "',CodIdiomaB='" & fidb & "',DescripcionB='" & fdeb & "',RutaImagen1='" & fimg1 & _ "',RutaImagen2='" & fimg2 & "',RutaImagen3='" & fimg3 & "' WHERE ID=" & idanun conex10.Execute(sql10) Like I say this ONLY happens when you click to upload a picture, you then go the upload page, it uploads it all totally fine, it rememebers all the field data on the form, so it is not as though it is losing any values?? very very strange!!! Do you have any ideas as to what it might be??? (you would be helping a very desperate person who is tearing their hair out with this haha Thanks again |
|
#4
|
||||
|
||||
|
Do a response.write of you sql statement to make sure it is correct.
|
|
#5
|
|||
|
|||
|
Hi there, duh sorry yeh did that and have managed to solve it!! Somehow i had a duplicated ID variable throughout the image upload pages, so by the time it was back on the main form, the ID variable was something like this ID = 12, 12 So of course the comma being there was why it was messing up on the int!!! Anyway sorted now - PHEW!! Thank you and sorry for being dumb!
I wonder whether you could help me out with something else, and sorry if I am becoming a total nuicance!!! Could you just give me a brief explination of what each line of this code does, I understand the end result of what it does, but I need to tweak it for another options form and I am just getting to grips with javascript coding as i have kinda stuck to asp and relied on existing javascripts luckily! Anyway help would be so much appreciated )Thank you function ValidarCamposs() { var i,valor; for (i=0;i<document.comprar.pack.length;i++) { if (document.comprar.pack[i].checked) { valor=document.comprar.pack[i].value; } } document.comprar.action="immo-reganun.asp?idPack=" + valor + "&id=<%=idioma%>"; document.comprar.submit(); } |
|
#6
|
||||
|
||||
|
It loops through the checkboxes, determines which one is checked, it gets its value and adds it to the link to submit the form.
Code:
function ValidarCamposs()
{
var i,valor;
Loop through the checkboxes
for (i=0;i<document.comprar.pack.length;i++)
{
If the checkbox is checked
if (document.comprar.pack[i].checked)
{
store the value of the checked checkbox in the valor variable
valor=document.comprar.pack[i].value;
}
}
Set the action of the form and add the valor variables value to the link the form submits to
document.comprar.action="immo-reganun.asp?idPack=" + valor + "&id=<%=idioma%>";
Submit the form
document.comprar.submit();
}
|
|
#7
|
|||
|
|||
|
Thank you - your a Star!
|
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > error when I go to update data in a database via a form - Type mismatch Cint |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|