This topic is locked

link to record

6/9/2003 1:15:17 PM
ASPRunnerPro General questions
author

Is there any way to link to the edit page and pull up the specific record from the hyperlink I use instead of having the list page pass the var. I want somehting to the effect of. www.myserver.com/edit.asp?ID=1 to pull up the page for editing.
me

Sergey Kornilov admin 6/9/2003

Hi,
you can use link like this www.myserver.com/edit.asp?EditID=1.
If you have multiple key fields link will be like this:

www.myserver.com/edit.asp?EditID=1&EditID2=2&EditID3=3
Best regards,

Sergey Kornilov

500038 6/9/2003

i tried using this
http://68.15.233.94/ASP/dec_edit.asp?EditID=1
and I got this error.
Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'ID='.
Please help and thanks for the quick responce last time. :-)

Sergey Kornilov admin 6/9/2003

Hi,
I found that more changes required. You also need to modify your dec_edit.asp file.

Find this portion of code in your dec_edit.asp file ( around line 140 ).

if Request.form("action")="add" or Request.form("action")="added" then

    strSQL="select * from " & strTableName & " where 1<0"

    Response.Write "<h1>Add new record</h1>"

else

    strSQL="select " & AddWrappers(strKeyField) & ...  & " from " & strTableName & " where " & AddWrappers(strKeyField) & "=" & strQuote & Replace(request.form("editid") ,"'","''") & strQuote

Response.Write "<h1>Edit record [" & strKeyField & ": " & request.form("editid") & "]</h1>"

end if


Make required changes ( in bold )

if Request.QueryString("EditID")<>"" then

    strEditID = Request.QueryString("EditID")

else

    strEditID = Request.Form("EditID")

end if
if Request.form("action")="add" or Request.form("action")="added" then

    strSQL="select * from " & strTableName & " where 1<0"

    Response.Write "<h1>Add new record</h1>"

else

    strSQL="select " & AddWrappers(strKeyField) & ...  & " from " & strTableName & " where " & AddWrappers(strKeyField) & "=" & strQuote & Replace(strEditID,"'","''") & strQuote

    Response.Write "<h1>Edit record [" & strKeyField & ": " & strEditID & "]</h1>"

end if


I hope this helps.
Sergey Kornilov

J
JAGwebdev 6/10/2003

ok made all the nec. changes and now it pulls up the record just fine but when I press the submit button to make the changes I get the error:
Error number -2147217900

Error description [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'ID='.

URL /ASPALL/all_edit.asp

SQL query select ID,ID ,[Service Director] ,[Service Number] ,[Last Name] ,[First Middle Name] ,[Obituary Name] ,[Death Date] ,[Birth Date] ,[Family Contact] from [all] where ID=
We are getting closer <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=268&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />

Sergey Kornilov admin 6/10/2003

Hi,
hopefully it's final change <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=269&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />
You need to move this portion of code to the very begining of edit.asp file.

<%

if Request.QueryString("EditID")<>"" then

strEditID = Request.QueryString("EditID")

else

strEditID = Request.Form("EditID")

end if

%>


and replace all occurencies of Request.Form("EditID") (except the above one) with strEditID.
Sorry it took that long to resolve.
Sergey Kornilov

J
JAGwebdev 6/25/2003

Now it does not save the record after I have entered the data. It just refreshes the edit page and does not give me a confirmation of this record has been saved.
<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=293&image=1&table=forumreplies' class='bbc_emoticon' alt=':blink:' />