strSQL1 = "DELETE (StatoAttivo) VALUES( ' " & iStatoAttivo & " ') FROM Staff WHERE Nome= ' " & iNome & " ' And Cognome= ' " & iCognome & " ' And Alias= ' " & iAlias & " ' "
Mi dà errore!
strSQL1 = "DELETE (StatoAttivo) VALUES( ' " & iStatoAttivo & " ') FROM Staff WHERE Nome= ' " & iNome & " ' And Cognome= ' " & iCognome & " ' And Alias= ' " & iAlias & " ' "
Mi dà errore!
credo che vada scritta così:
strSQL1 = "DELETE (StatoAttivo) FROM Staff WHERE Nome = ' " & iNome & " ' And Cognome = ' " & iCognome & " ' And Alias = ' " & iAlias & " ' "
05.08.2005 - by alka
Auguri all'angelo custode dei moderatori.
La sintassi corretta della delete è:
[code]
DELETE * FROM nomeTabella WHERE condizione
[code]
Values c'entra ben poco!
Ciaoz
è già la seconda in conteporanea :gren: :gren: :gren: :gren:Originariamente inviato da ladyBlu
credo che vada scritta così:
strSQL1 = "DELETE (StatoAttivo) FROM Staff WHERE Nome = ' " & iNome & " ' And Cognome = ' " & iCognome & " ' And Alias = ' " & iAlias & " ' "
Mi dà: Error syntax near '('.
niente parentesi:
se usi ACCESS:
delete * from NomeTabella where Campo1=PIPPPO
se usi SQL Server
delete NomeTabella where Campo1=PIPPO
Ho provato a fare come dici tu: mi mette Invalid object name 'StatoAttivo'. StatoAttivo è il nome del mio campo, è corretto
strSQL1 = "DELETE StatoAttivo FROM Staff WHERE Nome = ' " & iNome & " ' And Cognome = ' " & iCognome & " ' And Alias = ' " & iAlias & " ' "
DEvi fare DELETE * FROM ...
Non devi indicare il nome del campo! Dlete cancella uno o più record. Non i campi!
Se vuoi cancellare il contenuto di un campo solo devi fare UPDATE
già hai ragione, che tempismo che abbiamo!!!Originariamente inviato da JamesD
è già la seconda in conteporanea :gren: :gren: :gren: :gren:
:tongue:
prova così:Originariamente inviato da xit
Ho provato a fare come dici tu: mi mette Invalid object name 'StatoAttivo'. StatoAttivo è il nome del mio campo, è corretto
strSQL1 = "DELETE StatoAttivo FROM Staff WHERE Nome = ' " & iNome & " ' And Cognome = ' " & iCognome & " ' And Alias = ' " & iAlias & " ' "
strSQL1 = "DELETE Staff.StatoAttivo FROM Staff WHERE Nome = ' " & iNome & " ' And Cognome = ' " & iCognome & " ' And Alias = ' " & iAlias & " ' "
forse StatoAttivo è una parola chiave e quindi non gli piace che la usi come campo della tabella.
05.08.2005 - by alka
Auguri all'angelo custode dei moderatori.
non devi mettere il nome del campo, ma della tabella. il nome del campo non serve visto che delete cancella tutto il record quindo tutti i campi