Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
This is a classic asp code, i want to write this code in asp.net c#. Please any one help me.

XML
<%
response.buffer=false
id=killchars(request.querystring("id"))



    Response.ContentType = "text/xml"
    set con = server.CreateObject("adodb.connection")
    con.open strCon


    set rs=Server.CreateObject("ADODB.Recordset")
    sqltxt="SELECT top 12 id,title FROM table1 where status=1 and not id="&id&" and admin_no is NULL order by sticky desc,date desc"
    'response.write sqltxt
    rs.open sqltxt,con,0,1



    Response.Write "<?xml version=""1.0"" encoding=""iso-8859-1"" ?>" & vbCrlf
    Response.Write "<rss version=""2.0"">" & vbCrlf
    Response.Write "<channel>" & vbCrlf
    Response.Write "<title>Recent results</title>" & vbCrlf

    Do while Not rs.eof


    Response.Write "<item>" & vbCrlf
    Response.Write "<title>" & encode(rs("title")) &"</title>" & vbCrlf
    Response.Write "<link>http://localhost/news/"&cleanstring(rs("title"))&"-"&rs("id")&".asp</link>" & vbCrlf
    'Response.Write "<price>" & rs("sb_price")&"</price>" & vbCrlf
    'Response.Write "<description>"  & vbCrlf
    'Response.Write "<![CDATA[" & vbCrlf
    'Response.Write left(replace(rs("sb_details"),"&","and"),100)& "...]]>" & vbCrlf
    'Response.Write "</description>" & vbCrlf
    Response.Write "</item>" & vbCrlf

    rs.MoveNext
    Loop
    Response.Write "</channel>" & vbCrlf
    Response.Write "</rss>" & vbCrlf

    rs.Close
    set rs = nothing
    con.Close
    set con= nothing

%>



Thanks in advance

I just want to know what is the best procedure to do that
Posted
Updated 27-Jun-11 19:55pm
v2
Comments
Sergey Alexandrovich Kryukov 28-Jun-11 1:52am    
Not a question. What's the problems? Nobody is going to do your job.
--SA

Well, you would ignore all this horrible code and start again. In ASP.NET you use a control like a gridview or, if you want this level of control, a repeater. You get your data through a data layer, and then bind it to a grid. If you want to send XML, then you create it on the server ( best way is to request XML from SQL Server IMO ) and send that.
 
Share this answer
 
You need to learn ASP.NET first.
http://msdn.microsoft.com/en-us/library/ms123401.aspx[^]

http://www.asp.net/[^]

Thanks,
Mamun
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900