Nigel Keith-Walker
asked on
asp tutorial for programmer
I have inherited a web based application. To be accurate I am the system analyst who designed the system from the user's requirements.
My skillset goes back a long way with programming skills, over 30 years. However I have never maintained a web based system before.
There is a need to add another column to a report produced from teller_report.asp. Viewing this in a text editor, I could almost determine what needs to be done.
Can someone recommend an online tutorial on how to link this to Visual Studio 2016?
Secondly could someone suggest how I can set up a test environment to test my changes? I have the ability to create a copy of the database. Though the report is just that it does not update the tables.
Attached is a screenshot of FTP of some of the files.
Thanks
FTP_ASP_Files.jpg
My skillset goes back a long way with programming skills, over 30 years. However I have never maintained a web based system before.
There is a need to add another column to a report produced from teller_report.asp. Viewing this in a text editor, I could almost determine what needs to be done.
Can someone recommend an online tutorial on how to link this to Visual Studio 2016?
Secondly could someone suggest how I can set up a test environment to test my changes? I have the ability to create a copy of the database. Though the report is just that it does not update the tables.
Attached is a screenshot of FTP of some of the files.
Thanks
FTP_ASP_Files.jpg
ASKER
Interesting. So to add another column to the following report coding:
To include the Country would be adding:
Response.Write("<td class="""& strClass &""">"& objRS("Country") &"</td>")
How does it proportion itself across a screen?
If objRS.Eof Then
Response.Write("<tr><td colspan=""7"" class=""cell"" align=""center"">No transactions found for the teller and time period specified.</td></tr>")
Else
While Not objRS.Eof
If i > 1 Then
If objRS("RecCurr") <> strPreviousCurr Then
blnConsistantCurrency = False
End If
End If
If i Mod 2 = 0 Then
strClass = "cell"
Else
strClass = "alt_cell"
End If
'If CBool(objRS("PayoutFlag")) Then
'strStatus = "Complete"
'Else
'strStatus = " "
'End If
dblTotal = dblTotal + CDbl(Nz(objRS("RecAmount")))
Response.Write("<tr>")
Response.Write("<td class="""& strClass &""">"& objRS("IMERef") &"</td>")
Response.Write("<td class="""& strClass &""" style=""text-align:right;"">"& objRS("TDate") &"</td>")
Response.Write("<td class="""& strClass &""">"& objRS("SendName") &"</td>")
Response.Write("<td class="""& strClass &""">"& objRS("RecName") &"</td>")
Response.Write("<td class="""& strClass &""" style=""text-align:left;"">"& objRS("PayoutCheckTmStamp") &"</td>")
Response.Write("<td class="""& strClass &""" style=""text-align:left;"">"& objRS("PayoutTmStamp") &"</td>")
Response.Write("<td class="""& strClass &""" style=""text-align:right;"">"& FormatNumber(Nz(objRS("RecAmount")) ,2) &" "& objRS("RecCurr") &"</td>")
Response.Write("</tr>")
i = i + 1
strPreviousCurr = objRS("RecCurr")
objRS.MoveNext
Wend
To include the Country would be adding:
Response.Write("<td class="""& strClass &""">"& objRS("Country") &"</td>")
How does it proportion itself across a screen?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK. So I have changed the stored procedure to include a field : Country. I have made changes to teller_report2.asp.
How can I trigger off the report?
How can I trigger off the report?
if you know where the original report is on the website, like
www.mywebsite.com/report/teller_report.asp
all you have to do is go to the page by putting a 2 at the end of the report like:
www.mywebsite.com/report/teller_report2.asp
www.mywebsite.com/report/teller_report.asp
all you have to do is go to the page by putting a 2 at the end of the report like:
www.mywebsite.com/report/teller_report2.asp
ASKER
Seemed like a great idea. First I negotiate the logon screen, then I can enter teller_report2. Within this there is a display button, which sends me back to the original teller_report.
A possibility is to wait till Sunday when no-one is on the system.
A possibility is to wait till Sunday when no-one is on the system.
Shouldn't matter if there is anyone in the system as long as there is no update in the database,
you can login then navigate to teller_report.asp first, then you should be able to change the browser link to teller_report2.asp
does that redirect you to teller_report.asp ?
you can login then navigate to teller_report.asp first, then you should be able to change the browser link to teller_report2.asp
does that redirect you to teller_report.asp ?
Unless if you want to replace teller_report.asp in production and check it there, probably yes it would be ideal if no one was in the system,
As a good practice, I would also make sure that the original file is safe by copying to something like BKP_teller_report.asp I doubt that there would be any version control.
But what you can do is change the original teller_report.asp to teller_report_OLD.asp then rename teller_report2.asp to teller_report.asp if you want to test directly in the existing location. All depends on how frequently the file is accessed.
As a good practice, I would also make sure that the original file is safe by copying to something like BKP_teller_report.asp I doubt that there would be any version control.
But what you can do is change the original teller_report.asp to teller_report_OLD.asp then rename teller_report2.asp to teller_report.asp if you want to test directly in the existing location. All depends on how frequently the file is accessed.
ASKER
Yep. Standard practice for always retaining the original. Just in case we need to revert to it.
Thanks for your help.
Thanks for your help.
Not a problem. Any time.
ASKER
I was able to use UltraEdit for the FTP access to the website and to use as a text editor. It highlights keywords in different colours, making it easier to read. I had expected to learn how to use a tool specifically designed for web development. But for a simple change to a report this has been an easier option.
Notepad++ is good for editing and small changes, it highlights as well and it's free, but out of the box it doesn't have FTP, may be possible with some plugin which I have never tried,
WinSCP or Filezilla can be used for FTP separately too. ASP is too old now, with modern Microsoft languages Visual Studio will be the way to go.
WinSCP or Filezilla can be used for FTP separately too. ASP is too old now, with modern Microsoft languages Visual Studio will be the way to go.
I am not certain why any of the other experts did not suggest this.
So, I am going to chime in here.
The coding is OLD, and with that said, it is using what is not considered to be industry standards in coding.
The code below is HOW your code SHOULD be presented.
This allows for you, and everyone else that comes after you, to easily manipulate and edit the code as needed.
It is a little time consuming to edit the existing code to look like this, However. It will allow for faster troubleshooting and for quicker modifications to the code.
You "Should" be able to take the following code, and run it inside of your project, without many modifications.
The below code will also look good inside of Adobe Dreamweaver and Visual Studio as well as other visual editors.
Good Luck.
Wayne
So, I am going to chime in here.
The coding is OLD, and with that said, it is using what is not considered to be industry standards in coding.
The code below is HOW your code SHOULD be presented.
This allows for you, and everyone else that comes after you, to easily manipulate and edit the code as needed.
It is a little time consuming to edit the existing code to look like this, However. It will allow for faster troubleshooting and for quicker modifications to the code.
You "Should" be able to take the following code, and run it inside of your project, without many modifications.
The below code will also look good inside of Adobe Dreamweaver and Visual Studio as well as other visual editors.
Good Luck.
Wayne
<table>
<%
If objRS.Eof Then%>
<tr>
<td colspan="7" class="cell" align="center">No transactions found for the teller and time period specified.</td>
</tr>
<%Else
While Not objRS.Eof
If i > 1 Then
If objRS("RecCurr") <> strPreviousCurr Then
blnConsistantCurrency = False
End If
End If
If i Mod 2 = 0 Then
strClass = "cell"
Else
strClass = "alt_cell"
End If
'If CBool(objRS("PayoutFlag")) Then
'strStatus = "Complete"
'Else
'strStatus = " "
'End If
dblTotal = dblTotal + CDbl(Nz(objRS("RecAmount")))%>
<tr>
<td class="<%=strClass%>"><%=objRS("IMERef")%></td>
<td class="<%=strClass%>" style="text-align:right;"><%=objRS("TDate")%></td>
<td class="<%=strClass%>"><%=objRS("SendName")%></td>
<td class="<%=strClass%>"><%=objRS("RecName")%></td>
<td class="<%=strClass%>" style="text-align:left;"><%=objRS("PayoutCheckTmStamp")%></td>
<td class="<%=strClass%>" style="text-align:left;"><%=objRS("PayoutTmStamp")%></td>
<td class="<%=strClass%>" style="text-align:right;"><%=FormatNumber(Nz(objRS("RecAmount")) ,2)%><%=objRS("RecCurr")%></td>
</tr>
<%i = i + 1
strPreviousCurr = objRS("RecCurr")
objRS.MoveNext
Wend
%>
</table>
ASKER
Thanks for the suggestion that the coding is old and should be refreshed. Since this is a slight amendment to just one of the scripts, I will be following the format of the original programmer.
However I have commenced watching some Channel 9 talks on using Visual studio with code analysers. Is this the best way to improve the coding?
However I have commenced watching some Channel 9 talks on using Visual studio with code analysers. Is this the best way to improve the coding?
Unfortunately, Visual Studio can't do anything about ASP code, the only use of VS for ASP code would be highlighting/ coloring the tags and words. It will actually be a waste of memory to use VS to edit ASP code. VS is very powerful when you use the new tech and code in .NET
By the way, I wouldn't be worrying about how the code is I have been through code which looks exactly like that a lot.
My biggest suggestion would be not to change the code.
By the way, I wouldn't be worrying about how the code is I have been through code which looks exactly like that a lot.
My biggest suggestion would be not to change the code.
ASKER
Can anyone identify the favour of C from the code sample? Is it C# or C++?
Which code sample?
ASKER
Looking again at the report code again, I see that it refers to javascript. Perhaps this was written in java.
See new code sample.
See new code sample.
<!--#include file="includes/general.asp"-->
<!--#include file="includes/authentication_required.asp"-->
<%
blnIsPostBack = CBool(Request.Form("IsPostBack"))
Set objConn = New DataConn
If blnIsPostBack Then
dteFrom = Trim(Request.Form("txtFrom"))
dteTo = Trim(Request.Form("txtTo"))
TellerID = Request.Form("selTeller")
' Get the teller's name
Set objRS = objConn.Execute("web_select_user_by_id '"& TellerID &"'")
If Not objRS.Eof Then
strTellerName = objRS("Firstname") &" "& objRS("Lastname")
End If
Else
dteFrom = FormatDateTime(Date(), 2)
dteTo = dteFrom
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>IMEXFX Teller Report</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="imexfx.css" />
<script type="text/javascript" src="scripts/general.js"></script>
<script type="text/javascript" src="scripts/timeout.js"></script>
<script type="text/javascript">
function DisplayReport(){
var intErrors = 0;
var strErrors = "The report could not be displayed for the following reason(s):\n";
if(!IsDate(trim(document.frm.txtFrom.value))){
intErrors++;
strErrors += "Please enter a valid 'From' date in dd/mm/yyyy format.\n";
}
if(!IsDate(trim(document.frm.txtTo.value))){
intErrors++;
strErrors += "Please enter a valid 'To' date in dd/mm/yyyy format.\n";
}
if(intErrors == 0){
document.frm.IsPostBack.value = "1";
document.frm.submit();
} else {
alert(strErrors);
}
}
</script>
</head>
<body>
<div id="container">
<div id="header"><!--#include file="includes/header.asp"--></div>
<div id="navigation"><!--#include file="includes/navigation.asp"--></div>
<div id="content">
<h1>Teller Transaction Report</h1>
<form name="frm" method="post" action="teller_report.asp">
<input type="hidden" name="IsPostBack" />
<table align="center" cellpadding="1" cellspacing="1" style="background-color:#666666;">
<tr>
<%
If Session("Level") = "A" Or Session("Level") = "D" Or Session("Level") = "S" Then
Response.Write("<th>Teller</th>")
End If
%>
<th>From</th>
<th>To</th>
<th>Display Report</th>
</tr>
<tr>
<%
i = 0
If Session("Level") = "T" Then
Response.Write("<input type=""hidden"" name=""selTeller"" value="""& Session("UserID") &""" />")
Else
Response.Write("<td class=""cell""><select name=""selTeller"">")
Set objRS = objConn.Execute("web_select_tellers '"& Session("Level") &"', '"& Session("Paycode") &"'")
While Not objRS.Eof
Response.Write("<option value="""& objRS("Userid") &"""")
If CStr(strTellerID) = CStr(objRS("Userid")) Then
Response.Write(" selected=""selected""")
End If
Response.Write(">"& UCase(objRS("Lastname")) &", "& objRS("Firstname"))
If Not CBool(objRS("Status")) Then
Response.Write(" [Inactive]")
End If
Response.Write("</option>")
objRS.MoveNext
Wend
objRS.Close
Set objRS = Nothing
Response.Write("</select></td>")
End If
%>
<td class="cell"><input type="text" name="txtFrom" size="8" maxlength="12" value="<%= dteFrom %>" /></td>
<td class="cell"><input type="text" name="txtTo" size="8" maxlength="12" value="<%= dteTo %>" /></td>
<td class="cell"><input type="button" value="Display Report" onClick="DisplayReport();" /></td>
</tr>
<tr>
<%
If Session("Level") = "A" Or Session("Level") = "D" Or Session("Level") = "S" Then
Response.Write("<td class=""footer_cell""> </td>")
End If
%>
<td class="footer_cell" colspan="2" align="center">(dd/mm/yyyy)</td>
<td class="footer_cell"> </td>
</tr>
</table>
</form>
<%
If blnIsPostBack Then
%>
<p><strong>Teller:</strong> <%= strTellerName %><br />
<strong>Period:</strong> From <%= dteFrom %> to <%= dteTo %></p>
<table align="center" cellpadding="2" cellspacing="1" bgcolor="#333333">
<tr>
<th>TT Number</th>
<th>Send Date</th>
<th>Customer Name</th>
<th>Receiver Name</th>
<th>Logan Payout Date</th>
<th>Local Payout Date</th>
<th>Payout Amount</th>
</tr>
<%
Set objRS = objConn.Execute("web_teller_report '"& TellerID &"', '"& MediumDate(dteFrom) &"', '"& MediumDate(dteTo) &" 23:59:59'")
dblTotal = 0
blnConsistantCurrency = True
If objRS.Eof Then
Response.Write("<tr><td colspan=""7"" class=""cell"" align=""center"">No transactions found for the teller and time period specified.</td></tr>")
Else
While Not objRS.Eof
If i > 1 Then
If objRS("RecCurr") <> strPreviousCurr Then
blnConsistantCurrency = False
End If
End If
If i Mod 2 = 0 Then
strClass = "cell"
Else
strClass = "alt_cell"
End If
'If CBool(objRS("PayoutFlag")) Then
'strStatus = "Complete"
'Else
'strStatus = " "
'End If
dblTotal = dblTotal + CDbl(Nz(objRS("RecAmount")))
Response.Write("<tr>")
Response.Write("<td class="""& strClass &""">"& objRS("IMERef") &"</td>")
Response.Write("<td class="""& strClass &""" style=""text-align:right;"">"& objRS("TDate") &"</td>")
Response.Write("<td class="""& strClass &""">"& objRS("SendName") &"</td>")
Response.Write("<td class="""& strClass &""">"& objRS("RecName") &"</td>")
Response.Write("<td class="""& strClass &""" style=""text-align:left;"">"& objRS("PayoutCheckTmStamp") &"</td>")
Response.Write("<td class="""& strClass &""" style=""text-align:left;"">"& objRS("PayoutTmStamp") &"</td>")
Response.Write("<td class="""& strClass &""" style=""text-align:right;"">"& FormatNumber(Nz(objRS("RecAmount")) ,2) &" "& objRS("RecCurr") &"</td>")
Response.Write("</tr>")
i = i + 1
strPreviousCurr = objRS("RecCurr")
objRS.MoveNext
Wend
End If
%>
<tr>
<th colspan="6" style="text-align:right;">Total:</th>
<th style="text-align:right;">
<%
Response.Write(FormatNumber(dblTotal ,2))
If blnConsistantCurrency Then
Response.Write(" "& strPreviousCurr)
End If
%></th>
</tr>
</table>
<%
End If
Set objConn = Nothing
%>
<p> </p>
</div>
<div id="footer"><!--#include file="includes/footer.asp"--></div>
</div>
</body>
</html>
No, this code is classic asp, you can also see that from the file name extension, from the syntax also from the top line:
<!--#include file="includes/general.asp "--> as it includes other asp file
But it also includes javascript.
the javascript reference is within the HTML section, they basically all work together. You can use ASP to output HTML code e.g you can display multiple rows of an HTML table, or just simply do all the server side business logic and calculations and database reads etc.
javascript is executed on the client side, used for DOM manipulation, before submitting the information to the server, you can do things like, gui manipulation/changes, do validation and error handling, e.g. check if email address is properly formed or phone number is numeric etc.
C is more for desktop applications, C++ is not a common web language as well, probably people may call you insane if you try to do web with C/C++.
C# yes as a part of .NET framework you can use it for web dev. Java is also different than JavaScript and Java is not used in web instead there is JSP (Java Server Pages).
Top ones for web are currently PHP and .NET.
<!--#include file="includes/general.asp
But it also includes javascript.
the javascript reference is within the HTML section, they basically all work together. You can use ASP to output HTML code e.g you can display multiple rows of an HTML table, or just simply do all the server side business logic and calculations and database reads etc.
javascript is executed on the client side, used for DOM manipulation, before submitting the information to the server, you can do things like, gui manipulation/changes, do validation and error handling, e.g. check if email address is properly formed or phone number is numeric etc.
C is more for desktop applications, C++ is not a common web language as well, probably people may call you insane if you try to do web with C/C++.
C# yes as a part of .NET framework you can use it for web dev. Java is also different than JavaScript and Java is not used in web instead there is JSP (Java Server Pages).
Top ones for web are currently PHP and .NET.
ASKER
Thanks. I have been looking at the .ASP files and can see where it is connecting to the server.
To be able to set up an exact environment in your development environment may take time, if you have the database then you need to set up IIS an app pool etc..
Since this is just a report and it will only do read, and it won't update anything in the database you should be safe to test it in production environment, and it should be possible for you to duplicate the report file with another name like
teller_report2.asp and test and see the changes that way.
If you are talking about setting up VS 2016 so that you can open and edit the file, I find that unnecessary for ASP, notepad or notepad++ is what I would be using since you can not debug the ASP code.
But If you really want to use VS for FTP you can just go to File menu / Open select Web Site then select FTP and put the FTP details.
Here is a link to a tutorial:
http://asptutorial.info/learn/OpenReadCreate-files.html
Happy to help with the ASP code if you are stuck.