navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Update Records

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Update Records
Page: [1]
 
phd26

 

Posts: 32
Joined: 10/10/2005
Status: offline

 
Update Records - 10/20/2005 11:31:20   
Ok now that I have my search and add new record pages up and running the way I need it to, I need to get the update records page working :) Again I search the other post but can't find what I need.

What I wanted to do is from the results of the search page, allow the users after they performed their search to select a record to update. What I was hoping was to allow the user to use a radio button to select the specific record to update and then press the update button and then send the info to a new page with textboxes and populate them with the record.

What I have so far are the radio buttons that are assigned the IssueID from the Issue table from my db. Is there a way to use that info to send to the edit page and then pull the record from the db to populate the text boxes?
BeTheBall

 

Posts: 6355
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Update Records - 10/20/2005 18:39:53   
http://www.frontpagewebmaster.com/m-294205/tm.htm

As far as how you get to the edit page, I always make a particular column of my results table into a hyperlink that when clicked goes to the edit page carrying with it the ID of the record.

Here's an example:

http://www.thatswhatido.net/Artists.asp

Just click an ID to get to the edit page.

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to phd26)
phd26

 

Posts: 32
Joined: 10/10/2005
Status: offline

 
RE: Update Records - 10/21/2005 8:45:50   
Yeah I found out how to do that while looking around the forums but I was hoping to use option or check boxes with a button instead of hyperlinks to send the record to the edit page. For me its not a big deal if I use hyperlinks but the guy at work thats making me make the site really wants check boxes or the option buttons to make my life difficult, haha.

Thanks

(in reply to BeTheBall)
rdouglass

 

Posts: 9202
From: Biddeford, ME USA
Status: offline

 
RE: Update Records - 10/21/2005 9:37:31   
quote:

What I was hoping was to allow the user to use a radio button to select the specific record to update and then press the update button and then send the info to a new page with textboxes and populate them with the record


You should be able to do that. You said you assigned the IssueID to the buttons. As long as you assigned it to the *value* and not the name you should be OK. If all the radio buttons have the same name, you should be able to use Request.form("myRadioButtonName") to grab the single IssueID. From that you should be able to load the record into the edit form.

That help any?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to phd26)
phd26

 

Posts: 32
Joined: 10/10/2005
Status: offline

 
RE: Update Records - 10/21/2005 10:14:10   
Cool I didn't know about the request.form(" ") thing, where exactly would I put that? Does it go into the button code or in the edit page?

(in reply to rdouglass)
rdouglass

 

Posts: 9202
From: Biddeford, ME USA
Status: offline

 
RE: Update Records - 10/21/2005 10:58:45   
quote:

where exactly would I put that?


You would use that wherever you're processing the form fields. If your form posts to an update page, that's where it would go. If it posts to itself, it would go on that page wherever the form handler is.

Are you using a DRW?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to phd26)
phd26

 

Posts: 32
Joined: 10/10/2005
Status: offline

 
RE: Update Records - 10/21/2005 11:00:05   
I created the forms with a DRW and then I put it on the spooky diet.

(in reply to rdouglass)
rdouglass

 

Posts: 9202
From: Biddeford, ME USA
Status: offline

 
RE: Update Records - 10/21/2005 11:21:04   
Can you post the SQL you're using in the DRW and I'll show you how it should look?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to phd26)
phd26

 

Posts: 32
Joined: 10/10/2005
Status: offline

 
RE: Update Records - 10/21/2005 11:22:09   
also for the button I assume I need it to tell it where to send the record to the update form. So i'm guessing I need to put in something for the button code like onclick="Request.Form(Selection)?edit_page.asp", don't know the exact code i'd need for it.

(in reply to phd26)
phd26

 

Posts: 32
Joined: 10/10/2005
Status: offline

 
RE: Update Records - 10/21/2005 11:23:41   
for the results page:

<%
'Function to build query for search

Dim Search

Search = ""

If Request("KeywordsText") = "" then
Search = ""
Else
Search = "((KeywordsText LIKE '%::KeywordsText::%') OR (IssueTitle LIKE '%::KeywordsText::%'))"
End If

If Request("ProductName") > "" then
If Search = "" then
Search = "(ProductName LIKE '%::ProductName::%')"
Else
Search = Search & "AND (ProductName LIKE '%::ProductName::%')"
End If
End If

If Request("UserName") > "" then
If Search > "" then
Search = Search & "AND (UserName LIKE '%::UserName::%')"
Else
Search = "(UserName LIKE '%::UserName::%')"
End If
End If

If Request("VersionText") > "" then
If Search > "" then
Search = Search & "AND (VersionText LIKE '%::VersionText::%')"
Else
Search = "(VersionText LIKE '%::VersionText::%')"
End If
End If

'If query string is still blank, set a No Record Found value
If Search = "" then
Search = "(KeywordsText LIKE 'xxxx')"
End If
%>

<%
fp_sQry="SELECT * FROM Issues WHERE ("&Search&")"
fp_sDefault="KeywordsText=&ProductName=&UserName=&VersionText=&"
fp_sNoRecords="<tr><td colspan=7 align=left width=""100%"">No records returned.</td></tr>"
fp_sDataConn="dsg_kb"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_iDisplayCols=7
fp_fCustomQuery=True
BOTID=0
fp_iRegion=BOTID
%>

and for the edit page:

<%
fp_sQry="UPDATE Issues SET IssueIndex='::IssueIndex::', IssueTitle='::IssueTitle::', ProductName='::ProductName::', VersionText='::VersionText::', SymptomText='::SymptomText::', ResolutionText='::ResolutionText::', ResolutionDate='::ResolutionDate::', UserName='::UserName::', KeywordsText='::KeywordsText::' WHERE IssueIndex=::IssueIndex:: "
fp_sDefault="IssueIndex=&IssueTitle=&ProductName=&VersionText=&SymptomText=&ResolutionText=&ResolutionDate=&UserName=&KeywordsText=&IssueIndex="
fp_sNoRecords="No records returned."
fp_sDataConn="dsg_kb"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_iDisplayCols=16
fp_fCustomQuery=True
BOTID=0
fp_iRegion=BOTID
%>

(in reply to phd26)
rdouglass

 

Posts: 9202
From: Biddeford, ME USA
Status: offline

 
RE: Update Records - 10/21/2005 11:31:01   
quote:

fp_sQry="UPDATE Issues SET IssueIndex='::IssueIndex::', ...., KeywordsText='::KeywordsText::' WHERE IssueIndex=::IssueIndex:: "


Try this:

....KeywordsText='::KeywordsText::' WHERE IssueIndex = " & Request.form("IssueID")

That is assuming you named your radio buttons "IssueID". See, the front page DRW uses 2 colons as "request delimiters" so for the DRW,

::IssueIndex::

is the same as

Request("IssueIndex")

That help any?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to phd26)
phd26

 

Posts: 32
Joined: 10/10/2005
Status: offline

 
RE: Update Records - 10/21/2005 11:41:00   
when I put that in the page won't load up, also I don't have the update button on the results page working yet so thats going to difficult testing anthing out

(in reply to rdouglass)
phd26

 

Posts: 32
Joined: 10/10/2005
Status: offline

 
RE: Update Records - 10/21/2005 11:42:53   
nevermind I wrote the code wrong now i get this error:

Database Results Error
Description: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'IssueIndex='.
Number: -2147217900 (0x80040E14)
Source: Microsoft OLE DB Provider for ODBC Drivers

One or more form fields were empty. You should provide default values for all form fields that are used in the query.

(in reply to phd26)
rdouglass

 

Posts: 9202
From: Biddeford, ME USA
Status: offline

 
RE: Update Records - 10/21/2005 11:46:58   
quote:

also for the button I assume I need it to tell it where to send the record to the update form. So i'm guessing I need to put in something for the button code like onclick="Request.Form(Selection)?edit_page.asp", don't know the exact code i'd need for it.


I thought you wanted to select the radio and then hit an update button. Is that not the case?

If you just want to click the button, why use radios at all? You could have just used an image of a button with a hyperlink. No one's gonna' see it change 'cause they're sent away. :)

However, if you do want to "submit upon click", I use a JavaScript function like so:

<input type="radio" value="XXX" checked name="IssueID" onclick="javascript:document.myFormName.submit();">

You just need to be sure your form has a name and that the onclick uses it.

That help?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to rdouglass)
rdouglass

 

Posts: 9202
From: Biddeford, ME USA
Status: offline

 
RE: Update Records - 10/21/2005 11:49:34   
quote:

Database Results Error
Description: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'IssueIndex='.
Number: -2147217900 (0x80040E14)
Source: Microsoft OLE DB Provider for ODBC Drivers

One or more form fields were empty. You should provide default values for all form fields that are used in the query.


You will need to post a form to the edit page for it to grab the value. Just loading it on it's own by browsing to it will not provide the required value for the script to work.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to rdouglass)
phd26

 

Posts: 32
Joined: 10/10/2005
Status: offline

 
RE: Update Records - 10/21/2005 11:55:00   
I do want a radio button to select a record for the result grid and then have the user hit a button to have the record go to a new page where it will populate textfields where the user can change the information

(in reply to rdouglass)
rdouglass

 

Posts: 9202
From: Biddeford, ME USA
Status: offline

 
RE: Update Records - 10/21/2005 13:08:41   
quote:

I do want a radio button to select a record for the result grid and then have the user hit a button to have the record go to a new page where it will populate textfields where the user can change the information


Then don't use the onclick code I posted. Just use a regular form.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to phd26)
phd26

 

Posts: 32
Joined: 10/10/2005
Status: offline

 
RE: Update Records - 10/21/2005 14:54:44   
I don't understand, just use a regular form, how do i use that to send the record to my edit page

(in reply to rdouglass)
rdouglass

 

Posts: 9202
From: Biddeford, ME USA
Status: offline

 
RE: Update Records - 10/21/2005 15:16:15   
quote:

how do i use that to send the record to my edit page


<form method="POST" action="myEditPage.asp">

Just put the name of the page you want to send it to in the action parameter.

That help?


_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to phd26)
TheMythe

 

Posts: 58
Joined: 9/16/2005
From: Ectalion
Status: offline

 
RE: Update Records - 10/24/2005 4:47:02   
I'm sorry, but I'm not getting any of this.
The page looks way better then the 2 pages I got in order to update my database records (which only works halfway still), but I do not see any type of connection or how to make this work. It looks fine and I want it (badly) but I do not know how to....

My code so far: (updaterecordinaanbouw.asp)

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Update een record</title>
</head>
<body background="Deventer2004.jpg" bgproperties="fixed"
onFocus="window.status='Stavoor'"
onBlur="window.status='Stavoor'" &>
<!-- #include file="connection_modulair.asp" -->
<%
'create and open the recordset object
rsCommon.Open "stavoor", adoCon, 1, 3, 2 %>

<% if not isEmpty(Request.QueryString) then recno = Request.QueryString("recno") 
if recno="" then %>
   <h5>Selecteer een Record</h5>
   <table width=90% cellspacing=1 cellpadding=5 border=1 bordercolorlight="#FFFF00" bordercolordark="#808000" bgcolor="#000000">
   <!-- begin column headers -->
   <tr>
      <th><font color="#FFFF00"><b><span style="text-transform: uppercase">Nummer</span></b></font></th>
      <th><font color="#FFFF00"><b><span style="text-transform: uppercase">Artikel</span></b></font></th>
      <th><font color="#FFFF00"><b><span style="text-transform: uppercase">Prijs</span></b></font></th></tr>
   <% 'cycle through the record set and display each row results
   recno = 1
   do until rsCommon.EOF %>
   <tr>
      <td><font color="#FFFF00"><b><span style="text-transform: uppercase"><%= rsCommon("nummer")%></span></b></font></td>
      <% if rsCommon("nummer")=1 then %>
         <td><font color="#FFFF00"><b><span style="text-transform: uppercase"><%= rsCommon("artikel")%></span></b></font></td>
      <% else %>
         <td><a href="updaterecordinaanbouw2.asp?recno=<%=recno%>"><font color="#FFFF00"><b><span style="text-transform: uppercase"><%= rsCommon("artikel")%></span></b></font></a></td>
      <% end if %>
      <td><font color="#FFFF00"><b><span style="text-transform: uppercase"><%= rsCommon("prijs")%></span></b></font></td></tr>
   <!-- next Row = next Record -->
   <% 'increment record position with MoveNext method
   rsCommon.MoveNext
   recno = recno+1
   loop 
   'close record set and flush object from memory
   rsCommon.Close
   set rsCommon = Nothing
   %>
   </table>
   <% if rowCount>8 then %>
<p><a href="#">Naar boven</a></p>
   <% else %>
   <% end if
else
   'move pointer to selected record
   recno = Request.Querystring("recno")-1
   rsCommon.MoveFirst
   rsCommon.Move recno
   'close record set and flush object from memory
   rsCommon.Close
   set rsCommon = Nothing
   adoCon.close
   set adoCon = Nothing
   end if %>
</body>
</html>


2nd page: (updaterecordinaanbouw2.asp)

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Update een record</title>
</head>
<body background="Deventer2004.jpg" bgproperties="fixed"
onFocus="window.status='Stavoor'"
onBlur="window.status='Stavoor'" &>
<!-- #include file="connection_modulair.asp" -->
<%
'create and open the recordset object
rsCommon.Open "stavoor", adoCon, 1, 3, 2 %>
   
<% if isEmpty(Request.Form) then %>
<h5>Om veranderingen op te slaan in de database, druk op Update.</h5>
      <form method="post" onsubmit="return validateForm(this)">
      <table width=85% cellspacing=1 cellpadding=3 border=0>
      <col width=40% align="right">
      <col width=60%>
      <tr>
         <td>Artikel:</td>
         <td><input maxlength=254 name='msgFrom' value="<%= rsCommon("artikel")%>"></td></tr>
      <tr>
         <td>Prijs:</td>
         <td><input maxlength=254 name='msgSubject' value="<%= rsCommon("prijs")%>"></td></tr>
         </table>
      <p><input type="submit" value="Update"> <input type="reset" value="annuleren" onclick="self.location.replace('updatearecord.asp')"></p>
   </form>
   <% else
      ' store db field names in fldsArray
      fldsArray = array ("artikel", "prijs")

      ' store form field values into valsArray
      valsArray = array (Request.Form("msgFrom"),Request.Form("msgSubject"))
   
      ' update the Recordset
      rsCommon.Update fldsArray, valsArray %>
   
<h5>Dit record is ge-update.</h5>
      <table width=90% cellspacing=1 cellpadding=5 border=1 bordercolorlight="#FFFF00" bordercolordark="#808000" bgcolor="#000000">
      <col width=35% align="right">
      <% for each field in rsCommon.Fields %>
      <tr>
         <td><font color="#FFFF00"><b><span style="text-transform: uppercase"><%= field.Name %></span></b></font></td>
         <td><font color="#FFFF00"><b><span style="text-transform: uppercase"><%= field.Value %></span></b></font></td></tr>
      <% next %>
      </table>
      
      <p><a href="#">Naar boven</a>   |   <a href="updaterecordinaanbouw.asp">Edit
      een Record</a></p>
   <% end if %>
</body>
</html>


Now I got a problem with the numbers in the first row displaying correctly and pointing to the right record, can someone help me as well?

Thanks in advance.


(in reply to rdouglass)
rdouglass

 

Posts: 9202
From: Biddeford, ME USA
Status: offline

 
RE: Update Records - 10/25/2005 8:20:36   
Do you have a URL for these pages? I'm having a little difficulty visualizing what you're looking for.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to TheMythe)
phd26

 

Posts: 32
Joined: 10/10/2005
Status: offline

 
RE: Update Records - 10/25/2005 9:04:31   
Is this code correct for my update button:

<form method="POST" action="edit_page.asp">
<p>
<input type="submit" value="Update" checked name="Request.Form("Selection")"></p>
</form>

Selection is what I named my option button.

So far it will open up the edit_page.asp where the text fields are to be populated from the results page for the record the user selected with the option button. But doesn't populate the fields and I get this error.

Database Results Error
Description: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'IssueIndex ='.
Number: -2147217900 (0x80040E14)
Source: Microsoft OLE DB Provider for ODBC Drivers

One or more form fields were empty. You should provide default values for all form fields that are used in the query.

Also I changed the query from an update query to a select statment from what I read I need to do this inorder to pull the records I need and then create another page with the update query.

Here is the query:

<%
fp_sQry="SELECT IssueTitle='::IssueTitle::', ProductName='::ProductName::', VersionText='::VersionText::', SymptomText='::SymptomText::', ResolutionText='::ResolutionText::', ResolutionDate=#::ResolutionDate::#, UserName='::UserName::', KeywordsText='::KeywordsText::' FROM Issues WHERE IssueIndex = "&Request.Form("Selection")&""
fp_sDefault="IssueTitle=&ProductName=&VersionText=&SymptomText=&ResolutionText=&ResolutionDate=&UserName=&KeywordsText=&IssueIndex="
fp_sNoRecords="No records returned."
fp_sDataConn="dsg_kb"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_iDisplayCols=9
fp_fCustomQuery=True
BOTID=0
fp_iRegion=BOTID
%>

< Message edited by phd26 -- 10/25/2005 9:17:21 >

(in reply to rdouglass)
rdouglass

 

Posts: 9202
From: Biddeford, ME USA
Status: offline

 
RE: Update Records - 10/25/2005 10:37:39   
quote:

<form method="POST" action="edit_page.asp">
<p>
<input type="submit" value="Update" checked name="Request.Form("Selection")"></p>
</form>


Try something like this:

<form method="POST" action="edit_page.asp">
<p>
<input type="text" name="IssueIndex" value="<%=Request.Form("Selection")%>">
<input type="submit" value="Update"></p>
</form>

And then use the following query in your DRW:

fp_sQry="SELECT IssueTitle='::IssueTitle::', ProductName='::ProductName::', VersionText='::VersionText::', SymptomText='::SymptomText::', ResolutionText='::ResolutionText::', ResolutionDate=#::ResolutionDate::#, UserName='::UserName::', KeywordsText='::KeywordsText::' FROM Issues WHERE IssueIndex = ::IssueIndex::"

You'll probably need to actually submit the form to see any results. That's probably why you got that error but let's try to get the parameter passesed first before we deal with the defaults.

That get you any closer?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to phd26)
phd26

 

Posts: 32
Joined: 10/10/2005
Status: offline

 
RE: Update Records - 10/25/2005 10:59:40   
I still am getting the same db error and the text box doesn't seem get the value of the option button when i select the record in the result grid

(in reply to rdouglass)
rdouglass

 

Posts: 9202
From: Biddeford, ME USA
Status: offline

 
RE: Update Records - 10/25/2005 11:11:30   
Do you have a URL we can look at?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to phd26)
phd26

 

Posts: 32
Joined: 10/10/2005
Status: offline

 
RE: Update Records - 10/25/2005 11:25:25   
I'd have to wait till I get home with a copy of it to publish, right now its on the companies intranet which you would need permissions on the domain to access it.

(in reply to rdouglass)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Update Records
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts