0
can any body solve this SQL code running total, it is not working MS ACCESS Database?
ID-OrderID-OrderDate-Amount-Running_Total
1-1-11/11/2016-120-120
2-2-11/11/2016-40-160
3-3-11/11/2016-30-190
4-4-11/11/2016-80-270
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@page import="java.sql.*"%>
<%@ page import="java.util.Calendar" %>
<%
//java Code 25/11/2016
try
{
String date = (new java.util.Date()).toString();
String OrderDate=request.getParameter("OrderDate");
int OrderID = Integer.parseInt(request.getParameter("OrderID"));
int Amount = Integer.parseInt(request.getParameter("Amount"));
int Running_Total=Integer.parseInt(request.getParameter("Running_Total"));
String sql_debit="select OrderID,OrderDate,Amount,(select sum(Amount) from CustomerOrders where OrderID <= OrderID)'Running_Total' from CustomerOrders";
String s="jdbc:odbc:Database2";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection(s);
Statement pstmt=conn.createStatement();
Calendar calendar = Calendar.getInstance();
java.sql.Date startDate = new java.sql.Date(calendar.getTime().getTime());
ResultSet result = pstmt.executeQuery(sql_debit);
//int count = 0;
while (result.next())
{
//result.getInt("Running_Total");
Running_Total = result.getInt(1);
//result.getInt(1);
String output = "User #%d: %s ";
System.out.println(String.format(output, Running_Total));
}
conn.close();
}
catch(Exception ex)
{
System.err.println(ex.getMessage());
}
%>
</body>
</html>

0
Use regex those are best for validation for phonenumbers,pincode and so on
http://stackoverflow.com/questions/28716539/how-to-validate-pin-code-mobile-number-and-email-in-javascript
For saving and rerieving images
http://stackoverflow.com/questions/21452418/source-code-to-store-image-into-mysql-database-and-retrieve-it-and-display-in-js