Build a table with ASP.net

E

egsdar

Hello, I have a code that I did in ASP and need to migrate to ASP.Net. This
is my code in ASP 3.0:


<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<%
set conn=server.CreateObject ("ADODB.connection")
conn.Open ("Driver={MySQL ODBC 3.51
Driver};SERVER=localhost;DATABASE=proyectos;UID=root;PWD=4116734")

set Rs1=server.CreateObject ("ADODB.Recordset")
set Rs2=server.CreateObject ("ADODB.Recordset")

sql1="select * from modasg,modulos where modasg.cod="&session("codigo")&"
and modulos.cod=modasg.codmodulo group by modulos.padre order by codmodulo"

set rs1=conn.execute(sql1)
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="Micss.css" rel="stylesheet" type="text/css">
</head>

<body background="Images/fondo_Menu.gif" id="fondo" leftmargin="0">
<p>



<table width="10" border="0" cellspacing="0" style="width:150px;">
<%while not rs1.eof%>
<tr>
<td><img src="<%=rs1("imagen")%>"></td>
</tr>
<%sql2="select * from modasg,modulos where
modasg.cod="&session("codigo")&" and modulos.cod=modasg.codmodulo and
modulos.padre="&rs1("padre")&" order by codmodulo"
set rs2=conn.execute(sql2)
while not rs2.eof%>
<tr><td onMouseOver="this.style.color='#ff9900';"
onMouseOut="this.style.color='#000000';" style="cursor:hand"><div
align="left"><strong>
<font face="MS Sans Serif" size="1"><a
href="<%response.Write(rs2("modulo")+".asp")%>" target="mainFrame">

<%response.Write(""+rs2("modulo")+"")%>
</a></font></strong></div></tr></td>
<%
rs2.movenext
wend
rs1.movenext
wend%>
</table>
<p><br>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</body>
</html>

can u help me with this?
 
E

Eliyahu Goldin

ASP.NET is object-oriented. Use one of databound controls, most common is
GridView, define your data source and databind. This will produce a table.
There is no need to code it manually.
 
B

bruce barker

for a current webforms experience, you should look at linq, datasources
and a repeator. any beginning tutorial will over this example.

you may also want to look at the MVC toolkit which is template based
like asp, but seperates the view from the controller logic and allows
unit testing.

in either case you should avoid datasets (which are obsolete now) and
learn ado entity data models instead.

-- bruce( sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top