473,652 Members | 3,070 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to add a button to Modify, delete or add a new record to this code

The following code works fine I can connect to a SQL database and list
all the records in the Orders table onto a web page.

Now our users want me to modify it so that each row displayed as a
button or a hyperlink for Modify, Delete and also they want the data
displayed not in a HTML table as I am doing but like in a form they
want the ability to change the data in the fields. So when the user
clicks on the modify button for a row then they want to capture what is
on the screen and update the database table.
Similarly, if they click the delete button or hyperlink on a row they
want it deleted.

Also, at the end of displaying all records in the table they want a
button or link to insert a new record.

Can you kindly let me know the changes to this code to accomplish this.
Thanks
Karen

<html>
<title>test</title>
<body>
<%
dim cn, rs, sql
dbname = "NorthWind"
Cn = "provider=SQLOL EDB;network=DBM SSOCN;"
Cn = Cn & "uid=sa;pwd=sa; server="
Cn = cn & "testserver;dat abase=" & "NorthWind"
Set rs = Server.CreateOb ject("ADODB.Rec ordset")
sql = "select * from Orders"
rs.Open sql, cn
%>

<table BORDER="1" align="center" width="640">
<tr>
<td>OrderID</td>
<td>CustomerI d</td>
<td>ShipName</td>
<td>ShipCity</td>
<td>ShipCountry </td>
</tr>
<%
' Move to the first record
rs.movefirst
' Start a loop that will end with the last record
do while not rs.eof
%>
<tr>
<td>
<%= rs("OrderId") %>
</td>
<td>
<%= rs("CustomerId" ) %>
</td>
<td>
<%= rs("ShipName") %>
</td>
<td>
<%= rs("ShipCity") %>
</td>
<td>
<%= rs("ShipCountry ") %>
</td>
</tr>
<%
rs.movenext
loop %>
</table>
</body>
</html>
<%
rs.close
set rs=nothing
%>

Oct 1 '05 #1
2 2089
Hi Karen,

I take it from your code you are using ASP not ASP.NET?

Let me know and I will try to come up with some suggestions.

"ka***********@ yahoo.com" wrote:
The following code works fine I can connect to a SQL database and list
all the records in the Orders table onto a web page.

Now our users want me to modify it so that each row displayed as a
button or a hyperlink for Modify, Delete and also they want the data
displayed not in a HTML table as I am doing but like in a form they
want the ability to change the data in the fields. So when the user
clicks on the modify button for a row then they want to capture what is
on the screen and update the database table.
Similarly, if they click the delete button or hyperlink on a row they
want it deleted.

Also, at the end of displaying all records in the table they want a
button or link to insert a new record.

Can you kindly let me know the changes to this code to accomplish this.
Thanks
Karen

<html>
<title>test</title>
<body>
<%
dim cn, rs, sql
dbname = "NorthWind"
Cn = "provider=SQLOL EDB;network=DBM SSOCN;"
Cn = Cn & "uid=sa;pwd=sa; server="
Cn = cn & "testserver;dat abase=" & "NorthWind"
Set rs = Server.CreateOb ject("ADODB.Rec ordset")
sql = "select * from Orders"
rs.Open sql, cn
%>

<table BORDER="1" align="center" width="640">
<tr>
<td>OrderID</td>
<td>CustomerI d</td>
<td>ShipName</td>
<td>ShipCity</td>
<td>ShipCountry </td>
</tr>
<%
' Move to the first record
rs.movefirst
' Start a loop that will end with the last record
do while not rs.eof
%>
<tr>
<td>
<%= rs("OrderId") %>
</td>
<td>
<%= rs("CustomerId" ) %>
</td>
<td>
<%= rs("ShipName") %>
</td>
<td>
<%= rs("ShipCity") %>
</td>
<td>
<%= rs("ShipCountry ") %>
</td>
</tr>
<%
rs.movenext
loop %>
</table>
</body>
</html>
<%
rs.close
set rs=nothing
%>

Oct 4 '05 #2
Hi Helen

I am working on ASP.

If I was using ASP.Net I would have used one of the number of options.

Please help if you can for classic ASP.

Thanks
Karen

Oct 4 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4470
by: Franco Fellico' | last post by:
Hi. Suppose to have read and displayed (using PHP) a group of row of a DB table on a dinamyc table on a HTML/PHP page. The number of row displayed could be from 1 to n. Each row contains informations and also a cell with a unique ID of the element. I would like to show at the beginning of each line of the table a couple of cells containing two different icons (one for delete and one
5
1706
by: brian4cards | last post by:
http://www.igearonline.com/subscribe/admin.asp I have an html table that is loaded with database records. I have edit and delete options inside the table that edit or delete a given row. They all work fine except for the very first Edit option (the one that corresponds to the first row of data). Can anyone help me out. I have provided part of my code below. <%
0
422
by: karenmiddleol | last post by:
The following code works fine I can connect to a SQL database and list all the records in the Orders table onto a web page. Now our users want me to modify it so that each row displayed as a button or a hyperlink for Modify, Delete and also they want the data displayed not in a HTML table as I am doing but like in a form they want the ability to change the data in the fields. So when the user clicks on the modify button for a row then...
2
1899
by: uv | last post by:
Hi! I'm having problems submitting a new record through the form. I'm working with the wizard and I've added a control button to my form for entering entering a new record but for some reason it only works for the first record I enter. The same goes for deleting a record. It says I can't access the records, and that goes for both making or deleting. I'd appreciate your help very much, uv
3
13738
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum. Everyone wants to do a java confirmation box when a user clicks the delete button. Fair enough, basic user design rules state that you should always confirm a delete action. There is also a consensus that the best way to do this is a template...
14
4960
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons for things like delete, save, edit, cancel buttons - in the footer, or on the form detail section? 2. If in the footer, how do you add them to the tab order?
1
2243
by: Bill_W_Stephens | last post by:
I need a form with two buttons and ability to detect which button was pressed. I got this code to work using a javascript global variable, but I know there must be a better way using DOM. Any suggestions? <html> <head> <script language="JavaScript" type="text/javascript"> // global var: which button I am pressing var btnWhichButton;
2
1382
by: AA Arens | last post by:
When I add a button and choose in the wizzard for Delete Record operation, it does not work, instead it ADD's a record? How come? This is the VB contents of the button: Private Sub CmdDelete_Click() On Error GoTo Err_CmdDelete_Click DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
3
3420
by: bluez | last post by:
I want to design a webpage where user can search the data from the database and list out the related records. Each of the record got a delete button which allow user to delete the record. Filename : search_student.php <?php include("../user_access/user_access_control.php"); include("../Database/database.php"); $searchStudentControl = new Access_user;
7
6926
by: ITAutobot25 | last post by:
My delete button is not working in my GUI and my due date is today before midnight. Can anyone show me how to correct this error? My assignment statement is below as well as 5 classes. InventoryGUI is the main class to begin execution. Thanks! • Modify the Inventory Program to include an Add button, a Delete button, and a Modify button on the GUI. These buttons should allow the user to perform the corresponding actions on the item name, the...
0
8367
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8279
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8467
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8589
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7302
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5619
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2703
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1591
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.