Forums

ASP

This topic is locked

ASP, adding data to a table

Posted 14 Feb 2003 15:05:43
1
has voted
14 Feb 2003 15:05:43 rask one posted:
Hi,

I need to make a table on a server accessible for every user using a web browser. The user must be able to add data to the table and see data from the table. This is it. It should be very simple for someone who knows asp.

Thanks your helping me out big times!!!!!

Greetings,

Cedrick


Edited by - rask on 16 Feb 2003 12:24:10

Replies

Replied 15 Feb 2003 17:38:58
15 Feb 2003 17:38:58 Jørgen Emerslund replied:
OK, first of all, you'll need to do the coding. If you have a school project using asp, a part of the project is to learn the language if you don't know it from before.

Sorry if you didn't ask for finished code, but I felt the need to say it.

I'm not sure what you mean by retreive the data? Anyways, I will give you snippets of code I have used for listing data in tables, to give you a glimpse of a way to do it.

[code]
<%
' Sjekker om vi har trykket knappen for å legge til en post...
If Trim( Request.Form("AddNew") = "V" Then

' Add a record to the table

Elseif Trim( Request.Form("V") = "V" Then

' Update a record

Elseif Trim( Request.Form("X") = "X" Then

' delete on of the existing records

Else
%>
<table align="center">
<tr>
<th>CategoryID</th>
<th>Category</th>
<th> </th>
</tr>
<%
' Definerer en variabel for å nummerere formene, og setter denne lik 1
Dim i

' Code for the query and for creating the recordset

' Hvis vi er på slutten og begynnelsen av radsettet samtidig, da er det tomt
if rsRec.BOF Or rsRec.EOF = False then
' Løkke gjennom radsettet, og skriv ut liste over feltene
with rsRec
do until .EOF = true
i = i + 1
%>
<tr>
<form name="liste<% =i %>" method="post" action="<% =Request.ServerVariables("SCRIPT_NAME" %>">
<td>
<center>
<input value="<% =rsRec("CategoryID" %>" name="categoryid" readonly disabled class="textbox">
</center>
</td>
<td>
<center>
<input value="<% =rsRec("Category" %>" name="category" class="textbox">
</center>
</td>
<td>
<center>
<input type="hidden" name="HiddenID" value="<% =rsRec("CategoryID" %>">
<input type="submit" name="V" value=" V " class="button">
<input type="submit" name="X" value=" X " class="button">
</center>
</td>
</form>
</tr>
<%
.MoveNext
loop
End With
End If
End if
%>
<tr>
<form name="liste" method="post" action="<% =Request.ServerVariables("../guestbook/SCRIPT_NAME" %>">
<td>
<center>
<input name="categoryid" readonly disabled class="textbox">
</center>
</td>
<td>
<center>
<input name="category" class="textbox">
</center>
</td>
<td>
<center>
<input type="submit" name="AddNew" value=" V " class="button">
<input type="reset" name="ResetNew" value=" X " class="button">
</center>
</td>
</form>
</tr>
</table>
[code]

OK, if I understood you right, you probably haven't worked too much with ASP, so www.manastungare.com has a nice introduction if you need it....

You might not know how to work with databases, but experiment a little. And the code above should give you a hint on one way you might approach things.
Replied 17 Feb 2003 21:54:54
17 Feb 2003 21:54:54 rask one replied:
Is there anyway to store information without the use of a database. Like putting the data is HTML or XML or something like that???? Thank you in advance
Replied 19 Feb 2003 22:48:08
19 Feb 2003 22:48:08 Jørgen Emerslund replied:
Don't think that should be any big problem. But you'll need to look into working with files on the server (permissions!!!) I haven't done anything with it though, so can't help you there, unfortunately...

Reply to this topic