Recently, I picked up where another developer left off on a project. I am quite new to SQL and I have only been working with ASP for a few months. I have altered a table (bank_info) to include a 'Monthly' column to store a monthly payment calculated by the ASP code on one particular page, bankaccount.asp Now, I need to get the information about the payment (which is just a mathematical equation using variables) to the SQL table. This is my code:
This is the code that determines what the monthly payment will be. I need to get the information from the variable "Payment" to my column "Monthly" However, I don't really understand the previous developers' code for inserting data.
This is the code that writes the current information to the table. It is at the top of my ASP page:
I just need to insert the data from the variable "Payment" into the column "Monthly" If someone could please help me I would appreciate it so much! Thanks!!
Chris
This is the code that determines what the monthly payment will be. I need to get the information from the variable "Payment" to my column "Monthly" However, I don't really understand the previous developers' code for inserting data.
Code:
Dim TotalPayment,Total,Principal,Interest,Total1,Length,Payment,Time
TotalPayment=0
Total=0
Principal=0
Interest=0
Total1=0
Length=0
Payment=0
Time=0
strSQL="Select Current_Balance from creditor_info where Login='" & Login & "'"
rsSQL=ExecuteSelect(strSQL)
if isArray(rsSQL) then
for i = 0 to ubound(rsSQL,2)
Total=cdbl(Total) + cdbl(rsSQL(0,i))
next
end if
Principal=(cdbl (Total)*.025)
Interest=(cdbl (Principal)*.15)
Total1=(cdbl(Principal)+(Interest))
TotalPayment=(cdbl(Total1)+10+30)
Length=(cdbl(Total)/(TotalPayment))
Payment=CInt(TotalPayment)
Time=CInt(Length)
This is the code that writes the current information to the table. It is at the top of my ASP page:
Code:
<%
Login=Session("Login")
strSQL="SELECT ID FROM creditor_info WHERE Login='" & Login & "'"
rsSQL=ExecuteSelect(strSQL)
If isArray(rsSQL) Then
strSQL="SELECT ID FROM bank_info WHERE Login='" & Login & "'"
rsSQL=ExecuteSelect(strSQL)
if isArray(rsSQL) then
ID=rsSQL(0,0)
end if
dim msg
If Request.Form("flag")="1" Then
Name=request.form("Name")
BankName=request.form("BankName")
BankAccountNumber=request.form("BankAccountNumber")
SwiftCode=request.form("SwiftCode")
BankAddress=request.form("BankAddress")
BankAddress2=request.form("BankAddress2")
BankCity=request.form("BankCity")
BankState=request.form("BankState")
BankZip=request.form("BankZip")
TotalPayment=Request.Form ("TotalPayment")
strSQL = "INSERT INTO bank_info (Login, Name,Bank_Name,Bank_Account_Number,Swift_Code,Bank_Address,"
strSQL = strSQL & "Bank_Address2,Bank_City,Bank_State,Bank_Zip) VALUES('"& Login & "','" & Name & "','" & BankName & "','" & BankAccountNumber & "','" & SwiftCode & "','" & BankAddress & "','" & BankAddress2 & "','" & BankCity & "','" & BankState & "',"
If IsNull(BankZip) Or BankZip = "" then
strSQL = strSQL & "NULL)"
Else
strSQL = strSQL & BankZip & ")"
End If
ExecuteInsert(strSQL)
msg="Thank you for choosing Do-it-Yourself Debt Consolidation.<br><br>To view your estimated monthly payment, <a href='bankaccount.asp'>Click here</a>."
End If
If ID<>"" then
strSQL="SELECT * FROM bank_info WHERE ID='" & ID & "'"
rsSQL=ExecuteSelect(strSQL)
Login=rsSQL(1,0)
Name=rsSQL(2,0)
BankName=rsSQL(3,0)
BankAccountNumber=rsSQL(4,0)
SwiftCode=rsSQL(5,0)
BankAddress=rsSQL(6,0)
BankAddress2=rsSQL(7,0)
BankCity=rsSQL(8,0)
BankState=rsSQL(9,0)
BankZip=rsSQL(10,0)
end if
%>
I just need to insert the data from the variable "Payment" into the column "Monthly" If someone could please help me I would appreciate it so much! Thanks!!
Chris