用一个软件转换成asp.net代码根本没有办法用。
<%--
     Generated by ASP2ASPX 3.1. Copyright 2002-2003 Netcoole.
     ASP2ASPX home page: http://www.netcoole.com
     Original File Name: D:\work\Sunshine\Web-Test\index.asp
--%><%@ Page language = "VB" codepage = 936  Debug="true"%><%
    startime = Timer()
    start = Request.Form("start")
    destination = Request.Form("destination")
%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>北京理工大学乘车路线查询</title>
<style type="text/css">
<!--
.busNO {
font-family: "宋体";
font-size: 16px;
text-decoration: none;
background-color: #FFFFFF;
text-align: center;
color: #000000;
}
table {
font-family: "宋体";
font-size: 12px;
text-decoration: none;
background-color: #FF9933;
}
tr {
font-family: "宋体";
font-size: 12px;
text-decoration: none;
background-color: #FFFFFF;
}
input {
font-family: "宋体";
font-size: 12px;
color: #FF9933;
text-decoration: none;
border: 1px solid #9933;
}
select {
font-family: "宋体";
font-size: 12px;
color: #FF9933;
text-decoration: none;
border: 1px solid FF9933;
background-color: #FFFFFF;
}
body {
font-family: "宋体";
font-size: 12px;
color: #000000;
text-decoration: none;
}
-->
</style>
<script language="JavaScript">
function isempty()
{
  if(document.bitbus.destination.value=="")
  {
    alert("请输入目的地,嘿嘿");
return false;
  }
}
</script></head><body>
<form action="index.aspx" method="post" name="bitbus" id="bitbus" onSubmit="return isempty();">
<table width="778" cellpadding="1" cellspacing="1" align="center">
 <tr><td align="center" class="busNO">北京理工大学乘车路线查询</td></tr>
 <tr><td class="busNO">
  起点: 
  <select name="start">
    <option value="魏公村西口">魏公村西口</option>
    <option value="三义庙">三义庙</option>
    <option value="农科院" selected>农科院</option>
  </select>
  终点:
  <input name="destination" type="text" id="destination" maxlength="20">
  <input type="submit" name="Submit" value="查询">
 </td></tr>
</table></form>
<br/>
<%
    If destination <> "" Then 
        search(start, destination)
    End IF
%><br/>
<hr noshade size="1" style="border:1 dotted #FF9933" width="80%"/>
<center>
  Copyright&copy;<a href="http://btyz.51web.cn/" target="_blank">醉雨梧桐小站</a><br/>
  Powered by <a href="mailto:[email protected]">醉雨梧桐</a><br/>
<%
    endtime = Timer()
    Response.Write("执行时间:" & (endtime - startime) * 1000 & "毫秒")
%></center>
</body>
</html>
<script language="vb" runat=server>    Dim rs   ' As ADODB.Recordset
    Dim busNO   ' As adodb.field
    Dim route    ' As Object
    Dim s As Integer  
    Dim e As Integer  
    Dim temp As Integer  
    Dim route1 As String  
    Dim OutPut As String  
    Dim i As Integer  
    Dim start As String  
    Dim destination As String  
    Dim startime As Double 
    Dim endtime As Double 
    Function search(start, destination) 
        Dim conn  ' As ADODB.Connection
        Dim connstr As String 
        Dim db As String 
        db = "bus.mdb"
        '连接数据库
        On Error Resume Next
        conn = new ADODB.Connection()
        'connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source='"&Server.MapPath(""&db&"")&"';Jet OLEDB:DataBase PassWord='zhegebushishujuku'"
        connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" & Server.MapPath("" & db & "") & "';'"
        conn.Open(connstr)
        On Error Resume Next
        rs = conn.Execute("select busNO,route from bus where route like '%" & start & "%' and route like '%" & destination & "%'")
        busNO = rs.Fields("busNO")
        route = rs.Fields("route")
        If rs.BOF AND rs.EOF Then 
            Response.Write("没有结果")
        Else
            Response.Write("<table cellpadding='1' cellspacing='1' width='778' align='center'>")
            While Not rs.EOF
                s = InStr(route.Value.Value.ToString(), start)
                e = InStr(route.Value.Value.ToString(), destination)
                If s > e Then 
                    temp = s
                    s = e
                    e = temp
                End IF
                If s < 10 Then 
                    s = 1
                Else
                    s = s - 10
                End IF
                If Len(route.Value) - e < 10 Then 
                    e = Len(route.Value)
                Else
                    e = e + 10
                End IF
                route1 = Mid(route.Value, s, e - s)
                route1 = Replace(route1, start, "<font color='FF0000'>" & start & "</font>", 1, 1, 1)
                route1 = Replace(route1, destination, "<font color='FF0000'>" & destination & "</font>", 1, 1, 1)
                OutPut = "<tr><td class='busNO'>公共汽车:" & busNO.Value & "</td></tr><tr><td>" & route1 & "</td></tr>"
                Response.Write(OutPut)
                rs.MoveNext()
                i = i + 1
            End While
            Response.Write("<tr><td colspan='2' align='right'>" & start & "---" & destination & "共搜索到" & i & "个结果</td></td></table>")
        End IF
        rs = Nothing
        conn = Nothing
    End Function</script>

解决方案 »

  1.   

    如果你想充分利用asp.net的长处,那你就别指望转了,如果不是,那直接把扩展名改成.aspx就行了
      

  2.   

    <%@Page AspCompact="True" Language="VB" %>
    <%
    ''asp代码
    %>
      

  3.   

    OleDbConnection conn = new OleDbConnection("数据库连接串");
    OleDbDataAdapter cmd = new OleDbDataAdapter("select busNO, route from bus where route like '%" + start + "%' and route like '%" + destination + "%'", conn);
    DataSet ds = new DataSet();
    cmd.Fill(ds, "bus");
    string strHtml = "";
    if(ds.Tables["bus"].Rows.Count == 0)
    {
    strHtml = "没有结果";
    }
    else
    {
    strHtml += "<table cellpadding='1' align=center>";
    int temp = -1;
    for(int i = 0; i < ds.Tables["bus"].Rows.Count ; i++)
    {
    int s = route.IndexOf(start);
    int e = route.IndexOf(destination);if(s > 3)
    {
    temp = s;
    s = e;
    e = temp;
    }
    if(s < 10)
      s = 1;
    else
     s -= 10;
    ...
    .....
    ....
    .....
    }
    }
      

  4.   

    yuanxy(梦想鸭) 不是我说你, 你这也太懒 了吧
      

  5.   

    你就直接改文件后缀吧:.asp->.aspx