Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update specific record

Status
Not open for further replies.

davmold

IS-IT--Management
Jul 16, 2007
29
0
0
US
hello,

I came across a script for a guest book, This guest book script has an update_select.asp page that builds a link where you can click and it will redirect you to the specified record.
Code:
example [URL unfurl="true"]http://myserver/update_form?id=123[/URL]

this works well I was wondering if I could redirect it to
Code:
[URL unfurl="true"]http://myserver/update_form?id=123[/URL] and ?id2=001
 
It would be written like this:

Code:
[URL unfurl="true"]http://myserver/update_form?id=123&id2=001[/URL]

[monkey][snake] <.
 
I was looking at my sql statement and it looks something like this

Code:
Dim lngRecordNo			'Holds the record number to be updated


'Read in the record number to be updated
lngRecordNo = CLng(Request.Form("ID_no"))



'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblComments.* FROM tblComments WHERE ID_no=" & lngRecordNo

so I added

Code:
Dim lngRecordNo			'Holds the record number to be updated
Dim IngOrderNo			'Holds the work order number to be updated

'Read in the record number to be updated
lngRecordNo = CLng(Request.Form("ID_no"))
ingOrderNo  = CLng(Request.Form("monumber"))



'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblComments.* FROM tblComments WHERE ID_no=" & lngRecordNo and monumber=" & IngOrderNo
 
You're missing a little bit:

Code:
strSQL = "SELECT tblComments.* FROM tblComments WHERE ID_no=" & lngRecordNo [!]& "[/!] and monumber=" & IngOrderNo

Other than that, assuming your connection string and record sets are defined correctly, what you have should work.

[monkey][snake] <.
 
back to the link, I tried your first reply but it did not work, the statement that builds the link looks like this

Code:
Response.Write ("<a href=""update_form.asp?ID=" & rsGuestbook("LORD") & """>")

I am not sure how to add the
Code:
&amp;id2=001
 
make sure when you are requesting the form values the variable names are correct...get into the habit of assigning to variables..gets less confusing...also note you can use response.write shortcut in the html...some find this easier to read and create

also, is the model number always a number...or alphanumeric?...i used as string...change as needed

also, you have the hungarian prefix as ilg not lng for monumber...(again..make sure the vars match(request and sql in this situation)

also...the link is a querystring...not form...use request.querystring(foo)


Code:
<%
  '...if not rsGuestbook.eof then

  lngIDno = rsGuestbook("LORD") 
  strMonumber = "001" 'hardcoded...perhaps rs goes here
%>


  <a href="update_form.asp?ID_no=<%=lngIDno%>&monumber=<%=strMonumber%>">Update</a>

<%
  ' ... close statements
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top