Kan inte förstå detta Får följande fel:
Microsoft JET Database Engine error '80040e14'
Syntax error (missing operator) in query expression 'id ='.
/adm/adm_ed_studieforbund.asp, line 48
open_database "D:\fysisk sökväg",false
if request("organisation") <> "" then
if request("alt") <> "" then
Set Upload = Server.CreateObject("Persits.Upload")
Upload.Save "D:\WWW\fysisk sökväg"
Set File = Upload.Files("THEFILE")
If Not File Is Nothing Then
Filen = File.ExtractFileName
End If
organisation = Upload.Form("organisation")
adress = Upload.Form("adress")
hemsida = Upload.Form("hemsida")
tillhor = Upload.Form("tillhör")
postadress = Upload.Form("postadress")
telefon = Upload.Form("telefon")
fax = Upload.Form("fax")
epost = Upload.Form("epost")
beskrivning = Upload.Form("beskrivning")
upid = Upload.Form("alt")
strSQL = "UPDATE medlemmar SET organisation = '" & organisation & "', adress = '" & adress & "', hemsida = '" & hemsida & "', tillhör = '"&tillhor&"', postadress = '"&postadress&"', telefon = '"&telefon&"', fax = '"&fax&"', epost = '"&epost&"', logotyp = '"&filen&"', beskrivning = '"&beskrivning&"' "
strSQL = strSQL & " WHERE id = " & request("alt")
Conn.Execute strSQL
end if
end if
dim id
id = request("alt")
Set myRecSet = Server.CreateObject("ADODB.Recordset")
[B]Set myRecSet = Conn.Execute("SELECT * FROM medlemmar WHERE id = "&id&" " )[/B]%>
open_database "D:\fysisk-sökväg.mdb",false
if request("organisation") <> "" then
if request("alt") <> "" then
dim organisation, adress, hemsida
organisation = Hamtafrm("organisation")
adress = Hamtafrm("adress")
hemsida = Hamtafrm("hemsida")
tillhor = Hamtafrm("tillhör")
postadress = Hamtafrm("postadress")
telefon = Hamtafrm("telefon")
fax = Hamtafrm("fax")
epost = Hamtafrm("epost")
beskrivning = Hamtafrm("beskrivning")
strSQL = "UPDATE medlemmar SET organisation = '" & organisation & "', adress = '" & adress & "', hemsida = '" & hemsida & "', tillhör = '"&tillhor&"', postadress = '"&postadress&"', telefon = '"&telefon&"', fax = '"&fax&"', epost = '"&epost&"', beskrivning = '"&beskrivning&"' "
strSQL = strSQL & " WHERE id = " & request("alt")
Conn.Execute strSQL
end if
end if
dim id
id = request("alt")
Set myRecSet = Server.CreateObject("ADODB.Recordset")
Set myRecSet = Conn.Execute("SELECT * FROM medlemmar WHERE id = "&id&" " )
..men när jag försöker lägga till en bilduppladdningskomponent uppstår problemet. Vad har jag gjort fel i nedanstående kod?
open_database "D:\fysisk-sökväg.mdb",false
if request("organisation") <> "" then
if request("alt") <> "" then
Set Upload = Server.CreateObject("Persits.Upload")
Upload.Save "D:\fysisk-sökväg"
Set File = Upload.Files("THEFILE")
If Not File Is Nothing Then
Filen = File.ExtractFileName
End If
dim organisation, adress, hemsida
organisation = Upload.Form("organisation")
adress = Upload.Form("adress")
hemsida = Upload.Form("hemsida")
tillhor = Upload.Form("tillhör")
postadress = Upload.Form("postadress")
telefon = Upload.Form("telefon")
fax = Upload.Form("fax")
epost = Upload.Form("epost")
beskrivning = Upload.Form("beskrivning")
upid = Upload.Form("alt")
strSQL = "UPDATE medlemmar SET organisation = '" & organisation & "', adress = '" & adress & "', hemsida = '" & hemsida & "', tillhör = '"&tillhor&"', postadress = '"&postadress&"', telefon = '"&telefon&"', fax = '"&fax&"', epost = '"&epost&"', logotyp = '"&filen&"', beskrivning = '"&beskrivning&"' "
strSQL = strSQL & " WHERE id = " & request("alt")
Conn.Execute strSQL
end if
end if
dim id
id = request("alt")
Set myRecSet = Server.CreateObject("ADODB.Recordset")
Set myRecSet = Conn.Execute("SELECT * FROM medlemmar WHERE id = "&id&" " )
Du kan inte hämta med request från ett formulär (om du inte använder GET), samtidigt som du laddar upp en fil. Använd uppladdningskomponentens metoder för detta. (Upload.Form())
Fattar inget nu. Jag får felet Syntax error (missing operator) in query expression 'id ='. på sista raden i denna kod
pid = Upload.Form("alt")
strSQL = "UPDATE medlemmar SET organisation = '" & organisation & "', adress = '" & adress & "', hemsida = '" & hemsida & "', tillhör = '"&tillhor&"', postadress = '"&postadress&"', telefon = '"&telefon&"', fax = '"&fax&"', epost = '"&epost&"', logotyp = '"&filen&"', beskrivning = '"&beskrivning&"' "
strSQL = strSQL & " WHERE id ="&pid
Conn.Execute strSQL
end if
end if
dim id
id = request("alt")
Set myRecSet = Server.CreateObject("ADODB.Recordset")
Set myRecSet = Conn.Execute("SELECT * FROM medlemmar WHERE id = "&id&" " )
Har tyvärr redan provat den varianten också. När jag skriver ut så har id ett nummervärde som överensstämmer med det jag vill åt i db. **River hår (mycket tunnhårig nu) och fattar ingenting **
Jo, använder fortfarande request, men uppladdningskomponenten har väl gjord sitt och avslutats innan jag har kommit så långt? Vad är det jag inte fattar?
Som @nders skrev. Du kan inte på något sätt använda vanliga request.form när du blandar in komponenten. Varje komponent brukar ha ett sätt att "lösa/kombinera" detta. Du får titta på deras hemsida.