Jeg skal lave en UPDATE i min db.
Den ser således ud:
<%
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("tutorial.mdb")
Conn.Open DSN
Function checkBox2DBBool(boolVal)
If boolVal & "" = "" Then
checkBox2DBBool = "False"
Else
checkBox2DBBool = "True"
End If
End Function
Dim konto, bank, kontant, giro, bankcheck, vin,
gastronomi,vingastronomi
konto = checkBox2DBBool(Request.Form("konto"))
bank = checkBox2DBBool(Request.Form("bank"))
kontant = checkBox2DBBool(Request.Form("kontant"))
giro = checkBox2DBBool(Request.Form("giro"))
bankcheck = checkBox2DBBool(Request.Form("bankcheck"))
vin = checkBox2DBBool(Request.Form("vin"))
gastronomi = checkBox2DBBool(Request.Form("gastronomi"))
vingastronomi = checkBox2DBBool(Request.Form("vingastronomi"))
strSQL = "UPDATE personer "
strSQL = strSQL & "Firma, "
strSQL = strSQL & "Branche, "
strSQL = strSQL & "Kontaktperson, "
strSQL = strSQL & "CVRNummer, "
strSQL = strSQL & "Town, "
strSQL = strSQL & "Land, "
strSQL = strSQL & "Leveringsadresse, "
strSQL = strSQL & "Postnummer2, "
strSQL = strSQL & "Town2, "
strSQL = strSQL & "Land2, "
strSQL = strSQL & "Password, "
strSQL = strSQL & "Postnummer, "
strSQL = strSQL & "Website, "
strSQL = strSQL & "Telefonnummer, "
strSQL = strSQL & "Mobiltelefon, "
strSQL = strSQL & "Fax, "
strSQL = strSQL & "Email, "
strSQL = strSQL & "Adresse, "
strSQL = strSQL & "Noter, "
strSQL = strSQL & "Handler, "
strSQL = strSQL & "Comp, "
strSQL = strSQL & "Konto, "
strSQL = strSQL & "Bank, "
strSQL = strSQL & "Kontant, "
strSQL = strSQL & "Bankcheck, "
strSQL = strSQL & "Vin, "
strSQL = strSQL & "Gastronomi, "
strSQL = strSQL & "VinGastronomi, "
strSQL = strSQL & "Giro) "
strSQL = strSQL & "SET( "
strSQL = strSQL & "'" & Request.Form("Firma") & "', "
strSQL = strSQL & "'" & Request.Form("Branche") & "', "
strSQL = strSQL & "'" & Request.Form("Kontaktperson") & "', "
strSQL = strSQL & "'" & Request.Form("CVRNummer") & "', "
strSQL = strSQL & "'" & Request.Form("Town") & "', "
strSQL = strSQL & "'" & Request.Form("Land") & "', "
strSQL = strSQL & "'" & Request.Form("Leveringsadresse") & "', "
strSQL = strSQL & "'" & Request.Form("Postnummer2") & "', "
strSQL = strSQL & "'" & Request.Form("Town2") & "', "
strSQL = strSQL & "'" & Request.Form("Land2") & "', "
strSQL = strSQL & "'" & Request.Form("Password") & "', "
strSQL = strSQL & "'" & Request.Form("Postnummer") & "', "
strSQL = strSQL & "'" & Request.Form("Website") & "', "
strSQL = strSQL & "'" & Request.Form("Telefonnummer") & "', "
strSQL = strSQL & "'" & Request.Form("Mobiltelefon") & "', "
strSQL = strSQL & "'" & Request.Form("Fax") & "', "
strSQL = strSQL & "'" & Request.Form("Email") & "', "
strSQL = strSQL & "'" & Request.Form("Adresse") & "', "
strSQL = strSQL & "'" & Request.Form("Noter") & "', "
strSQL = strSQL & "'" & Request.Form("Handler") & "', "
strSQL = strSQL & "'" & Request.Form("Comp") & "', "
strSQL = strSQL & "" & konto & ", "
strSQL = strSQL & "" & bank & ", "
strSQL = strSQL & "" & kontant & ", "
strSQL = strSQL & "" & bankcheck & ", "
strSQL = strSQL & "" & vin & ", "
strSQL = strSQL & "" & gastronomi & ", "
strSQL = strSQL & "" & vingastronomi & ", "
strSQL = strSQL & "" & giro & ")"
Response.write strSQL
Response.end
Conn.Execute(strSQL)
%>
Her er hvad den udskriver:
UPDATE personer Firma, Branche, Kontaktperson, CVRNummer, Town,
Land, Leveringsadresse, Postnummer2, Town2, Land2, Password,
Postnummer, Website, Telefonnummer, Mobiltelefon, Fax, Email,
Adresse, Noter, Handler, Comp, Konto, Bank, Kontant, Bankcheck,
Vin, Gastronomi, VinGastronomi, Giro) SET( 'La Bottega',
'Importør af vin', 'Claus Rantzau', 'Ej oplyst', 'København S',
'Danmark', 'Bergthorasgade', '2300', 'København S', 'Danmark',
'Blackie', '2000', '
www.la-bottega.dk', '+45 61 69 67 62', 'Ej
oplyst', 'Ej oplyst', 'info@la-bottega.dk', 'Bergthorasgade',
'Flytter den 1/11-2003. ', '0 flasker', 'La Bottega', True, True,
True, True, True, True, True, True)
Hvad er der galt mons tro? Kan virkelig ikke regne den ud selv!
--
Vil du lære at kode HTML, XHTML, CSS, SSI eller ASP?
- Pædagogiske tutorials på dansk
- Kom godt i gang med koderne
KLIK HER! =>
http://www.html.dk/tutorials