BluAlex
Jan 23rd, 2001, 06:50 AM
Written in VB.
I want to edit a current record via browser.
I got it working, but when I edit a record and puts it into the database, the edited record overwrites the oldest record(the first record), and the record I want to edit remains the same as it was.
Ex.
I got 10 record from 1 to 10
I want to edit record number 10
when i have edited the record and put it back into the database the result is as follows:
record number 10 stays the same before the editing
record number 1 is overwritten by the edited record
how can i fix this problem?
the records got "id" as a primary key
my code
This is the code for putting the edited record into the database:
<%
Set objCon = Server.CreateObject ("ADODB.Connection")
Set objRec = Server.CreateObject ("ADODB.Recordset")
objCon.Open strcon
objRec.Open "news", objCon, adOpenDynamic, adLockPessimistic, adCmdTable
objRec("overskrift") = Request.Form("overskrift")
objRec("nyhetstekst") = Request.Form("nyhetstekst")
objRec("nyhetstekst2") = Request.Form("nyhetstekst2")
objRec("bilde") = Request.Form("bilde")
objRec("bilde2") = Request.Form("bilde2")
objRec("kilde") = Request.Form("kilde")
objRec("url") = Request.Form("url")
objRec("dato") = date()
objRec.Update
objRec.Close
Set objRec = Nothing
objCon.Close
Set objCon = Nothing
%>
what is missing/wrong?
I want to edit a current record via browser.
I got it working, but when I edit a record and puts it into the database, the edited record overwrites the oldest record(the first record), and the record I want to edit remains the same as it was.
Ex.
I got 10 record from 1 to 10
I want to edit record number 10
when i have edited the record and put it back into the database the result is as follows:
record number 10 stays the same before the editing
record number 1 is overwritten by the edited record
how can i fix this problem?
the records got "id" as a primary key
my code
This is the code for putting the edited record into the database:
<%
Set objCon = Server.CreateObject ("ADODB.Connection")
Set objRec = Server.CreateObject ("ADODB.Recordset")
objCon.Open strcon
objRec.Open "news", objCon, adOpenDynamic, adLockPessimistic, adCmdTable
objRec("overskrift") = Request.Form("overskrift")
objRec("nyhetstekst") = Request.Form("nyhetstekst")
objRec("nyhetstekst2") = Request.Form("nyhetstekst2")
objRec("bilde") = Request.Form("bilde")
objRec("bilde2") = Request.Form("bilde2")
objRec("kilde") = Request.Form("kilde")
objRec("url") = Request.Form("url")
objRec("dato") = date()
objRec.Update
objRec.Close
Set objRec = Nothing
objCon.Close
Set objCon = Nothing
%>
what is missing/wrong?