473,394 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

transferring record from one asp file to another

145 100+
I have a asp file which contain all recordset from access database in a table (List Products.asp). At each row there is a link which will open another file (Update Product.asp). The open file will contain record that is selected from List Products.asp.

So, how to get the selected record from List Products.asp appear on Update Product.asp. It will appear in a text box for each field.

Here what is contain in database.

Table: Products
Field: Product ID, Product Name, Product Price

Below is code for List Products.asp

Expand|Select|Wrap|Line Numbers
  1. <%language="javascript"%>
  2. <html>
  3. <body>
  4. <% var DSN="DSN=Bakery";
  5. var Conn = Server.CreateObject("ADODB.Connection");
  6. Conn.Open(DSN);
  7.  
  8. sql="SELECT * from Products";
  9. rs=Server.CreateObject("ADODB.Recordset");
  10. rs.Open(sql,Conn);
  11.  
  12. out+="<table border=1>"
  13. out +="<tr><td>Product ID</td><td>Product Name</td><td>Price</td></tr>";
  14.  
  15. while(!(rs.EOF))
  16. {
  17. out +="<tr><td><%rs("Product ID")%></td><td><%rs("Product Name")%></td><td><%rs("Product Price")%></td><td><a href="Update Product.asp"></a></td></tr>"
  18.  
  19. rs.move(1);
  20. }
  21.  
  22. out +="</table>"
  23. rs.Close();
  24. Response.write(out);
  25.  
  26. %>
  27. </body>
  28. </html>
  29.  
  30.  
I need help to create the sql for Update Product.asp and how to transfer record from List Products.asp to Update Product.asp
Sep 30 '09 #1
1 1957
JamieHowarth0
533 Expert 512MB
Hi puT3,

Your "Update Product.asp" file should simply be able to accept a querystring parameter so then you can do this:

Expand|Select|Wrap|Line Numbers
  1. Integer iProduct = CInt(Request.QueryString("pid"))
  2. ' Then declare your SQL as:
  3. strSQL = "SELECT * FROM Product WHERE ProductID = " & iProduct
  4.  
That'll then grab the individual product record from the table.
Now to actually pass the product ID to that page, you have to change the hyperlink in "List Products.asp" to read this:
Expand|Select|Wrap|Line Numbers
  1. out +="<tr><td><%rs("Product ID")%></td><td><%rs("Product Name")%></td><td><%rs("Product Price")%></td><td><a href="Update Product.asp?pid=<%rs("Product ID")%>"></a></td></tr>"
  2.  
Note that your Product ID has now been appended to the end of the URL as a parameter called "pid", which the Request.QueryString method in the Update Product.asp file can read and subsequently use to query your DB.

Hope this helps.

codegecko
Oct 1 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: http://www.visual-basic-data-mining.net/forum | last post by:
Does anyone have any idea how to transferring data from TextBox1 in form1 to textBox2 in form2..... That means after i fill in any data in textBox1 and click Next button... It will bring me to...
1
by: Murali | last post by:
Hi Everyone, I am writing a program to transfer a file from one linux pc to another linux pc. I am using linux-2.4.x and pppd-2.4.2 version . I have few queries: How to establish a PPP...
5
by: meetalps | last post by:
Hi All, Can you please help me with a step by step procedure to transfer files from my PC to DB2-AIX and vice versa. I am new to both. Example transferring a sql file to run from PC to DB2 on AIX....
9
by: Stimp | last post by:
I'm trying to copy an asp.net project onto another computer in order to work on it from there as well. Whatever way I set up the directory in IIS the project cannot be run on the new computer (I...
11
by: Timofmars | last post by:
I'm try to Unload DB2 data from a table into a record sequential file on NT. I can an unload on Mainframe, but it doesn't seem to be an option in NT. In NT, all I can do is export/import. I can...
10
by: MLH | last post by:
Suppose, in a multi-user environment, you have append query SQL in a VBA procedure that looks like INSERT INTO MyTable... and the next line reads MyVar=DMax("","MyTable... You can never be...
6
by: ControlHead | last post by:
Hello All, I have a tricky problem. I have two forms in MS Access where the user enters information. The first form links to a table with only one record where data is entered via text boxes....
2
by: cbs81 | last post by:
hi all, problem: transferring data from workbooks that are stored in a particular directory from excel to a table in access. when done, the workbooks that have been processed are automatically...
2
by: garther | last post by:
Hi I'm trying to get something like this to work: Application calculates data and stores them in local SQL server. Once a week this data needs to copied to DVD. Then I need second application...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.