473,503 Members | 1,697 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=SQLOLEDB;network=DBMSSOCN;"
Cn = Cn & "uid=sa;pwd=sa;server="
Cn = cn & "testserver;database=" & "NorthWind"
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "select * from Orders"
rs.Open sql, cn
%>

<table BORDER="1" align="center" width="640">
<tr>
<td>OrderID</td>
<td>CustomerId</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 2070
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=SQLOLEDB;network=DBMSSOCN;"
Cn = Cn & "uid=sa;pwd=sa;server="
Cn = cn & "testserver;database=" & "NorthWind"
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "select * from Orders"
rs.Open sql, cn
%>

<table BORDER="1" align="center" width="640">
<tr>
<td>OrderID</td>
<td>CustomerId</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
4461
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...
5
1697
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...
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...
2
1895
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...
3
13725
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....
14
4945
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...
1
2229
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...
2
1371
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...
3
3412
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. ...
7
6905
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...
0
7199
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,...
0
7074
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
7273
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7451
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...
1
5000
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3161
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1501
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 ...
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
374
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...

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.