Pagina 1 di 3 1 2 3 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 27
  1. #1

    errore nel fare l'update

    in questa procedura mi da un errore neo fare l'update: l'errore è questo:
    SELECT * FROM T_news Where id = 1

    codice:
    
    '**************************************
    'modificare
    '**************************************
    Sub EditItem()
    
    	Response.write ("<h2>Modifica record nella tabella " & strTable & "</h2>")
    	
    	which=request("which")
    	
    	if isNumeric(which) then
    		MySQL="SELECT * FROM " & strTable & " Where " & strKey & " = " & which
    	else
    		MySQL="SELECT * FROM " & strTable & " Where " & strKey & " = '" & which & "'"
    	end if
    	Set MyRs=MyConn.Execute(MySQL)
    
    	Response.write ("<FORM ACTION=""" & strFile & "?mode=EditItemAction"" METHOD=POST>")
    	Response.write ("<input name=""ID"" type=""hidden"" value=""" & MyRs(strKey) & """>")
    	Response.write ("<table>")
    
    	numerocampi=MyRs.fields.count -1
    	
    	for i=0 to numerocampi
    	
    	if Not MyRs(i).name = "id" then
    		ThisRecord = MyRs(i)
    		ThisRecordName = MyRs(i).name
    		If IsNull(ThisRecord) or ThisRecord = "" Then
    			ThisRecord = ""
    		end if 
    	Response.write ("<tr>")
    	Response.write ("<td align=""right"">" & ThisRecordName & ": </td>")
    	Response.write ("<td> <input name=""" & ThisRecordName & """ type=""text"" value=""" & MyRs(i) & """></td>")
    	Response.write ("</tr>")
    	end if
    	next
    
    	Response.write ("<tr>")
    	Response.write ("<td align=""right""><INPUT NAME=""Submit"" TYPE=Submit Value=""Update""></td>")
    	Response.write ("<td><INPUT NAME=""Reset"" TYPE=Reset Value=""Reset""></td>")
    	Response.write ("</tr>")
    	Response.write ("</table>")
    	Response.write ("</FORM>")
    
    	Response.write ("Torna alla lista dei record")
    		
    	MyRs.close
    	Set MyRs= Nothing
    
    End Sub
    
    
    Sub EditItemAction()
    
    	which = Request(strKey)
    	
    	if isNumeric(which) then
    		MySQL="SELECT * FROM " & strTable & " Where " & strKey & " = " & which
    	else
    		MySQL="SELECT * FROM " & strTable & " Where " & strKey & " = '" & which & "'"
    	end if
    
    	'MySQL="Select * from " & strTable
    	Set MyRs=MyConn.Execute(MySQL)
    
    	numerocampi=MyRs.fields.count -1
    
    	for i=0 to numerocampi
    		if Not MyRs(i).name = "ID" then	
    			str = MyRs(i).name 
    			strNames = Request(str)
    			if not i = numerocampi then
    				str1 = str1 & "[" & str & "] = '" & strNames & "', "
    			else
    				str1 = str1 & "[" & str & "] = '" & strNames & "'"
    			end if
    		end if
    	next
    
    	if isNumeric(which) then
    		MySQL1="UPDATE " & strTable & " SET " & str1 & " Where " & strKey & " = " & which
    	else
    		MySQL1="UPDATE " & strTable & " SET " & str1 & " Where " & strKey & " = '" & which & "'"
    	end if
    
    	'MySQL1="UPDATE " & strTable & " SET " & str1 & " Where ID=" & which
    
    	Response.Write(MySQL)
             Response.end
            Set MyRs=MyConn.Execute(MySQL) 
    
    	MyConn.Close
    	set MyConn=nothing
    	
    	Response.Redirect strFile
    
    End Sub

  2. #2

    Re: errore nel fare l'update

    Originariamente inviato da primi_passi
    in questa procedura mi da un errore neo fare l'update: l'errore è questo:
    SELECT * FROM T_news Where id = 1
    quello non è un errore, è uno statement. sii più preciso, grass

  3. #3
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    E' inutile aprire un'altra discussione per lo stesso problema, come da regolamento.

    Roby

  4. #4
    lo so ma siccome non so come fare a risolvere che devo fare?

  5. #5
    Originariamente inviato da primi_passi
    lo so ma siccome non so come fare a risolvere che devo fare?
    come prima cosa esponi bene il poblema.

  6. #6
    allora il pannelo per connettermi ad aruba con il database access, per modifcare cancellare ed eliminare dei record nel db.
    nel fare la modifica mi da questo messaggio SELECT * FROM T_news Where id = 1
    e ovviamente non mi fa fare l'update. il codice in esame è quello che ho postato, spero di essere stato chairo.

  7. #7
    no, non sei stato chiaro (almeno per me)

    però mi insospettisce questa sequenza di comandi

    codice:
    ...
       Response.Write(MySQL)
       Response.end
       Set MyRs=MyConn.Execute(MySQL) 
    ...
    sai spiegarmela?

  8. #8
    questa mi è stata detta da un ragazzo sul fporum per farmi sapare l'eventuale errore

  9. #9
    quindi non la capasci? non sai cosa fa?

  10. #10
    si in effetti non so, ma il problema che non mi fa l'update rimane

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.