0
Answer

convert ASP VBScript to ASP.NET(C#)~

vivian wei

vivian wei

10y
1.1k
1
I am trying to convert the following ASP VBScript to C# to use on our company's new ASP.Net 3.5 web site.
Can anyone help convert the following code .... ORZ

Much appreciated.
Vivian
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
<%@ Language=VBScript %> 
<% 'option Explicit %>
<%
Dim APP_NAME
APP_NAME = "WA10208"
Session("Group_ID") = "4"
%>
<!-- #include file="AppLoginCheck.inc" -->
<!-- #include file="Page_header.asp" -->
<!-- #Include File="SecurityEnhance.inc" -->
<form action="F4_LON008_Result_NBS.asp" method="post" name="main">
  <input type="hidden" id="func" name="func">
  <table align="center" class="qry_table">
  <tr>
  <td class="qry_title" style="text-align:center;font-size:medium">aaaa</td>
  </tr>
  <tr>
  <td class="qry_element">bbbb&nbsp;:&nbsp;
  <select name="data_date">
<%
Dim Conn, Rs, SqlStatement, DataDate, QueryDate, I
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.ConnectionTimeout = Application("PSI_ConnectionTimeout")
Conn.CommandTimeout = Application("PSI_CommandTimeout")
Conn.Open Application("PSI_ConnectionString"), Application("PSI_RuntimeUserName"), Application("PSI_RuntimePassword")
SqlStatement = "Select TODAY " & _
  "From " & Application("odsPROD_DB") & ".ETL_BUSDATE"
Set Rs = Conn.Execute(SqlStatement)
If Not Rs.Eof Then
  DataDate = Left(Rs("TODAY"), 6)
Else
  DataDate = Right("0000" & Year(Now()), 4) & Right("00" & Month(Now()))
End If
For I = 0 To 3
  QueryDate = DateAdd("m", I * -1, Left(DataDate, 4) & "/" & Right(DataDate, 2) & "/01")
  If I = 0 Then
%>
  <option value="<%= Right("0000" & Year(QueryDate), 4) & Right("00" & Month(QueryDate), 2) %>" selected><%= Right("0000" & Year(QueryDate), 4) & Right("00" & Month(QueryDate), 2) %></option>
<%
  Else
%>
  <option value="<%= Right("0000" & Year(QueryDate), 4) & Right("00" & Month(QueryDate), 2) %>"><%= Right("0000" & Year(QueryDate), 4) & Right("00" & Month(QueryDate), 2) %></option>
<%
  End If
Next
%>
  </select>
  </td>
  </tr>
  <tr>
  <td class="qry_element">CCCC&nbsp;:&nbsp;
  <select name="purpose_code">
  <option value="ALL" selected>DDD</option>
<%
SqlStatement = "Select PURPOSE_CODE, PURPOSE_DESC " & _
  "From " & Application("odsMISRPT_DB") & ".BKL_MG_PURPOSE_CODE " & _
  "Order By PURPOSE_CODE"
Set Rs = Conn.Execute(SqlStatement)
Do While Not Rs.Eof
%>
  <option value="<%= ProcessXSS(Rs("PURPOSE_CODE")) %>">
  <%= ProcessXSS(Rs("PURPOSE_CODE")) & " " & ProcessXSS(Replace(Trim(Rs("PURPOSE_DESC")), " ", "")) %></option>
<%
  Rs.MoveNext
Loop
Rs.Close
Conn.Close
Set Rs = Nothing
Set Conn = Nothing
%>
  </select>
  </td>
  </tr>
  <tr>
  <td align="center"><input type="button" value=" DDDD " name="Query" class="btn_query"></td>
  </tr>
<%
If Session("message") <> "" Then
%>
  <tr>
  <td colspan="2" class="bg_white"><p class="msg_text">EE:<%= Session("Message") %></p></td>
  </tr>
<%
End If
Session("message") = ""
%>
  </table>
</form>
<div align="right"><a href="menu_F4.asp">»»»FFFF</a></div>
<script language="javascript">
document.getElementById("Query").onclick = function () {
  this.disabled = true;
  main.func.value = "qry_detail";
  main.submit();
}
</script>
<!-- #include file="Page_tailer.asp" -->