This topic is locked

Direct Link to Edit Page

1/6/2004 2:30:29 PM
ASPRunnerPro General questions
Becca author

I've used Runner to generate code for my database's web-interface...but I'd like to customize a few things to make the interface more "user-friendly". The one thing in particular that I'm having some difficulty with is the edit link.
When users load the URL for my interface, they're prompted to login (all of my code is generated by Runner...) I've modified the <tablename>_login.asp page to re-route the users to a "Main Menu" page that lists links to the list pages for each of my tables.
The problem is that each user will only have one entry per table and to make it more user-friendly, there is no need to load the list page. We'd like them to go from the main menu directly to the edit page.
My question is: 1) Is this even possible and 2) If it is, how do I do it? I've found snipets of code that I thought should do the trick, but it doesn't. If anyone has any information that might be helpful, I'd greatly appreciate it. :-)
Thanks in advance for your help,
Becca

Sergey Kornilov admin 1/8/2004

Becca,
here is how you can do this. You need to modify ..._edit.asp page for this purpose. Please see my changes in bold. This section of code usually located around line 232 in ...edit.asp.

**if Request.QueryString("editid")<>"" then

  strSQL=strSQL & " where " & AddWrappers(strKeyField) & "=" & strQuote &


  Replace(request.QueryString("editid"),"'","''") & strQuote

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

  strEditID = Request.QueryString("editid")

else

  strSQL=strSQL & " where " & AddWrappers(strKeyField) & "=" & strQuote &

  Replace(request.form("editid"),"'","''") & strQuote

  if strKeyField2<>"" then


      strSQL=strSQL & " and " & AddWrappers(strKeyField2) & "=" & strQuote2 & Replace(request.form("editid2"),"'","''") & strQuote2

  if strKeyField3<>"" then _

      strSQL=strSQL & " and " & AddWrappers(strKeyField3) & "=" & strQuote3 & Replace(request.form("editid3"),"'","''") & strQuote3

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

 
strEditID = Request.QueryString("editid")

end if

end if
response.write message

response.write "<div align=left><hr width=300 noshade size=1></div>"
LogInfo(strSQL)

rs.open strSQL, dbConnection

Call ReportError
Response.write "&nbsp;&nbsp;&nbsp;<a href=cars_list.asp onClick=""GotoPage( " & mypage & "); return false;"">Back to list</a>"

Response.Write "<table cellpadding=2>"

%>
<form name=editform method=post action=cars_edit.asp >

<input type=hidden id="TargetPageNumber" name="TargetPageNumber" value="<%=Request.Form("TargetPageNumber")%>" >

<input type=hidden id=SQL name=SQL value="<%=Request.Form("SQL")%>">

<input type=hidden name=saveid value="<%=
strEditID%>">

<input type=hidden name=saveid2 value="<%=request.form("editid2")%>">

<input type=hidden name=saveid3 value="<%=request.form("editid3")%>">

<input type=hidden name=editid value="<%=
strEditID**%>">

<input type=hidden name=editid2 value="<%=request.form("editid2")%>">

<input type=hidden name=editid3 value="<%=request.form("editid3")%>">


After making these changes you can make a call to the edit page like this:

http://www.servername.com/.../..._edit.asp?editid=SomeUserIDHere
I hope this helps.
Best regards,

Sergey Kornilov

Becca author 1/12/2004

Sergey,
Thanks for the response...I tried your code above but once I get everything in place just the way you've listed, I get the following error:

Error number 3001

Error description Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.


I searched the forums for this error, and found a post for this error previously. You had asked the user to show their SQL statement - but even after setting debug to true in the variables file, I still don't get the SQL statement on the error page.
You also asked the user what database they were using, they were using SQL 7 or 2000, I'm using Access 2003, which is presently working just fine for all the other ASP pages I've created with and without Runner (I just checked..).
I'm not sure where to go from here...any chance you can help me out? Let me know what you need, I'll be happy to send anything you request on. If you prefer, you can contact me via email: becca@cmsemail.com
Thanks,
Becca