webForumDet fria alternativet

varför funkar inte dethär radbryts scriptet?

ASP

6 svar · 185 visningar · startad av His Divine Shadow

Medlem sedan sep. 20004 079 inlägg
Frågan#1

Rabrytnings scriptet har lsutat funka för mig, fattar inte varför...
Här är nu scriptet:

<%
'Declare all local variables

dim conn
dim rs
dim strID
dim strconn

'set a local variable to my DSN-less connection String
strconn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\data\WebData\katalog.mdb"

'Create the Connection object
set conn = server.createobject("adodb.connection")
conn.open strconn

'Create the recordset object
set rs = server.createobject("adodb.recordset")
'This statement opens the table so we can add a record notice the addnew
'The 2, 2 is how the table is opened there are many ways it can be opened
rs.open "Kat", conn, 2, 2

Function bryt(txt)
If IsEmpty(txt) OR IsNull(txt) Then Exit Function
txt = Server.HTMLEncode(txt)
txt = Replace(Trim(txt), vbCrLf, "<br>")
bryt = txt
End Function

rs("ovrigt_swe") = bryt("Ovrigt_swe")
rs("ovrigt_fin") = bryt("Ovrigt_fin")

'Use the addnew method of the recordset object to add a record
rs.update
'Set the table column = to my input text box from my form

rs("Namn") = request.Form("Namn")
rs("Naradress") = request.Form("Naradress")
rs("Postnr") = request.Form("Postnr")
rs("Ort") = request.Form("Ort")
rs("Tel") = request.Form("Tel")
rs("Fax") = request.Form("Fax")
rs("Epost") = request.Form("Epost")
rs("www") = request.Form("www")
rs("Amnesomrade") = request.Form("Amnesomrade")
rs("Ovrigt_swe") = request.Form("Ovrigt_swe")
rs("Ovrigt_fin") = request.Form("Ovrigt_fin")
rs("Password") = request.Form("Password")
rs.update
'I do a movelast here to get the ID that is automatically generated
'I also set the value to a local variable so I can write out to the database
rs.movelast
strID = rs("ID")

%>

<%

'Always! Always set your objects to nothing. This clears them out of servers memory
'Your network admins will like this

set rs= nothing
set conn = nothing

Response.Redirect "Focus.asp?ID=ID"
%>

------------------
His Divine Shadow is the most despicable being ever created.
If you were to gather together all the nastiest words in all the countries of the world, squash them together to make three words, they would come out as His Divine Shadow.<br>
http://forums.planetdivine-shadow.com

Medlem sedan dec. 200012 464 inlägg
#2

Vad får du för fel?

Jag ser inget anrop till rs.addnew i koden.

Är kat en tabell? I så fall skall du ange adCmdTable som (5:e) parameter till open.

------------------
essentitia preter non sans multiplicandum

Medlem sedan sep. 20004 079 inlägg
#3

"Vad får du för fel?"

Inget fel, bara ingen radbrytning.

"Jag ser inget anrop till rs.addnew i koden."

Det borde väl inte finnas då detta script uppdaterar redan tillagda poster.

"Är kat en tabell? I så fall skall du ange adCmdTable som (5:e) parameter till open."

Prövar.
Nej ingen radbrytning

------------------
His Divine Shadow is the most despicable being ever created.
If you were to gather together all the nastiest words in all the countries of the world, squash them together to make three words, they would come out as His Divine Shadow.<br>
http://forums.planetdivine-shadow.com

Medlem sedan dec. 19998 577 inlägg
#4

Du kör ju bryt på två vanliga textsträngar, som inte kommer ifrån variabler, skall det vara så?

rs("ovrigt_swe") = bryt("Ovrigt_swe")
rs("ovrigt_fin") = bryt("Ovrigt_fin")

------------------
Select * from world where gender = 'female' AND male = 'me'

[Redigerat av Vide den 10 sep 2001]

Medlem sedan sep. 20004 079 inlägg
#5

Ja jag tror det :)
Texten hämtas från ett formulär och dom fälten är av typen textarea i formuläret

------------------
His Divine Shadow is the most despicable being ever created.
If you were to gather together all the nastiest words in all the countries of the world, squash them together to make three words, they would come out as His Divine Shadow.<br>
http://forums.planetdivine-shadow.com

Medlem sedan dec. 19998 577 inlägg
#6

Jag tror du menar såhär jag ;):

rs("ovrigt_swe") = bryt(Request.Form("Ovrigt_swe"))
rs("ovrigt_fin") = bryt(Request.Form("Ovrigt_fin"))

------------------
Select * from world where gender = 'female' AND male = 'me'

Medlem sedan sep. 20004 079 inlägg
#7

No luck, ingen radbrytning...

------------------
His Divine Shadow is the most despicable being ever created.
If you were to gather together all the nastiest words in all the countries of the world, squash them together to make three words, they would come out as His Divine Shadow.<br>
http://forums.planetdivine-shadow.com

265 ms totalt · 4 externa anrop · v20260731065814-full.6fe65c25
119 ms — deklarationer (db)
0 ms — hämta statistik (cache)
144 ms — hämta tråd, inlägg och bilagor (db)
119 ms — ändringar (db)