www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Server-Side Development > ASP

    ASP Discussion and technical support for using and deploying Active Server Pages.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 02-20-2006, 10:24 PM
    hally hally is offline
    Registered User
     
    Join Date: Feb 2006
    Posts: 13
    How To Add Between two values

    hello im a student.. i have a problem.. i want to add the values between "peruntukan" and "ptambahan"


    below is my code: 1.new1.asp ( this one is a form for user to key in thier amount of budget)




    <html>
    <head>
    <title>SISTEM VOT BARU</title>
    </head>

    <script language = JavaScript>

    function verify()
    { document.returnValue = true;

    //check for blanks
    if (document.myForm.novot.value == "")
    {
    alert (" Sila masukkan No Vot!");
    document.returnValue = false;
    }


    if (document.myForm.tahun.value == "")
    {
    alert (" Sila masukkan Tahun!");
    document.returnValue = false;
    }


    if (document.myForm.peruntukan.value == "")
    {
    alert (" Sila masukkan Peruntukan Tahunan!");
    document.returnValue = false;
    }


    }


    </script>

    <BODY BGCOLOR="#000000">


    <CENTER>
    <IMG SRC="banner.jpg">
    </cENTER>

    <BR>
    <BR>
    <BR>
    <BR>
    <BR>
    <BR>

    <font face="Verdana, Tahoma">

    <FORM NAME="myForm" method="post" ACTION ="viewperuntukan1.asp" onSubmit="verify(); return document.returnValue">

    <TABLE BORDER="1" CELLPADDING="1" CELLSPACING="0" ALIGN="CENTER" VALIGN="TOP" WIDTH="95%"><TR><TD BGCOLOR="black">
    <TABLE BORDER="0" CELLPADDING="1" CELLSPACING="1" WIDTH="100%">


    <TR ALIGN="LEFT">
    <TD BGCOLOR="99CCFF" width=25%><font size="2" face="Verdana, Tahoma"><b>No Vot :<b></TD>
    <TD BGCOLOR="99CCFF"><font size="2" face="Verdana, Tahoma">
    <INPUT TYPE= "TEXT" name="novot" MAXLENGTH="32" SIZE="20">
    </TD>
    </TR>

    <TR ALIGN="LEFT">
    <TD BGCOLOR="99CCFF" width=25%><font size="2" face="Verdana, Tahoma"><b>Tahun :<b></TD>
    <TD BGCOLOR="99CCFF"><font size="2" face="Verdana, Tahoma">
    <INPUT TYPE= "TEXT" name="tahun" MAXLENGTH="32" SIZE="5">
    </TD>
    </TR>




    <TR ALIGN="LEFT">
    <TD BGCOLOR="99CCFF" width=25%><font size="2" face="Verdana, Tahoma"><b>Peruntukan Seperti Di Dalam Anggaran Tahunan ( RM ) :<b></TD>
    <TD BGCOLOR="99CCFF"><font size="2" face="Verdana, Tahoma">
    <INPUT TYPE= "TEXT" name="peruntukan" MAXLENGTH="32" SIZE="20">
    </TD>
    </TR>

    <TR ALIGN="LEFT">
    <TD BGCOLOR="99CCFF" width=25%><font size="2" face="Verdana, Tahoma"><b>Peruntukan Seperti Di Dalam Anggaran Tambahan ( RM ) :<b></TD>
    <TD BGCOLOR="99CCFF"><font size="2" face="Verdana, Tahoma">
    <INPUT TYPE= "TEXT" name="ptambahan" MAXLENGTH="32" SIZE="20">
    </TD>
    </TR>

    <TR ALIGN="LEFT">
    <TD BGCOLOR="99CCFF" width=25%><font size="2" face="Verdana, Tahoma"></TD>
    <TD BGCOLOR="99CCFF"><font size="2" face="Verdana, Tahoma">
    <P ALIGN=CENTER>
    <B>
    <INPUT TYPE="SUBMIT" VALUE="SUBMIT" NAME="SUBMIT">
    <INPUT TYPE="RESET" VALUE="BATAL" NAME="RESET">
    </B>
    </TD>
    </TR>


    </TABLE></TR></TD></TABLE>
    </FORM>
    </FONT>


    <BR>
    <BR>
    <BR>
    <BR>
    <BR>


    <FONT FACE="Verdana, Tahoma" SIZE="-2" COLOR="white">
    <br>
    <CENTER>Copyright Reserved 2006</a>
    </CENTER>
    </FONT>


    </FONT>

    </BODY>
    </HTML>





    the 2nd code : viewperuntukan1.asp ( this code is to show the correct amount after the value is added )




    <% @Language="Javascript" %>

    <%
    var dsn="dsn=VS";
    var Conn=
    Server.CreateObject("ADODB.Connection");
    Conn.Open(dsn);


    var no_vot = Request.Form("novot");
    var thn = Request.Form("tahun");
    var peruntukanthnn = Request.Form("peruntukan");
    var tmbh = Request.Form("ptambahan");



    var sql = "Insert into KE (NOVOT, TAHUN, PERUNTUKAN, ANGGARANT) VALUES ('"+no_vot+"','"+thn+"','"+peruntukanthnn+"', '"+tmbh+"');"

    Conn.Execute(sql);
    Conn.Close();
    Conn=null;

    %>


    <HTML>

    <HEAD>
    <TITLE>JUMLAH PERUNTUKAN TAHUNAN</TITLE>
    </HEAD>

    <link rel="stylesheet" type="text/css" href="images181/blue.css">

    <BODY BGCOLOR="#000000">

    <CENTER>
    <IMG SRC="banner.jpg">
    </cENTER>

    <BR>
    <BR>
    <BR>
    <BR>
    <BR>
    <BR>

    <FONT face="Verdana,Tahoma" COLOR="white">

    <CENTER>
    <P>Peruntukan bagi Tahun <%=Request.Form("tahun") %> ialah RM <%=Request.Form("peruntukan") %> + <%=Request.Form("ptambahan") %>
    </P>
    </CENTER>

    </FONT>



    <FONT face="Verdana,Tahoma" SIZE="3">
    <ALIGN="RIGHT">
    <BR>
    <BR>
    <P>
    <A HREF="addnew1.asp">seterusnya>>>></A>
    </P>
    </ALIGN>
    </FONT>


    <BR>
    <BR>
    <BR>

    <FONT FACE="Verdana, Tahoma" SIZE="-2" COLOR="white">
    <br>
    <CENTER>Copyright Reserved 2006</a>
    </CENTER>
    </FONT>



    </BODY>
    </HTML>


    But the problem is i dont know how to add this number.. please help me.. :cry: then there was an error in database( microsoft access) .. i dont know what to do.. help me.. :cry:


    than how i want to store this total value ( after add this two value ) in database ( microsoft access).. ??


    i really appreciate if someone can help me..
    Reply With Quote
      #2  
    Old 02-21-2006, 03:33 AM
    cusimar9 cusimar9 is offline
    Registered User
     
    Join Date: May 2005
    Posts: 502
    Quote:
    i want to add the values between "peruntukan" and "ptambahan"
    On your second page:

    var peruntukanthnn = Request.Form("peruntukan");
    var tmbh = Request.Form("ptambahan");
    var total = peruntukanthnn + tmbh

    Then to store it in the database you either have to create a new field to accommodate it, or you have to insert the total into one of your other fields
    Reply With Quote
      #3  
    Old 02-21-2006, 03:40 AM
    hally hally is offline
    Registered User
     
    Join Date: Feb 2006
    Posts: 13
    thank you.. its mean that i have to create new column in my table in database right? but how to store it? how was the coding? is that the same like the above code?
    Reply With Quote
      #4  
    Old 02-21-2006, 10:19 AM
    cusimar9 cusimar9 is offline
    Registered User
     
    Join Date: May 2005
    Posts: 502
    Well I suggest if you want to make changes to your tables download the database onto your local machine and open it in MS Access, add the column, then upload it back to the website
    Reply With Quote
      #5  
    Old 02-21-2006, 07:18 PM
    hally hally is offline
    Registered User
     
    Join Date: Feb 2006
    Posts: 13
    thanks.. can i do like this? this is my new code.. i hope u can help me..


    the 2nd code : viewperuntukan1.asp ( this code is to show the correct amount after the value is added )



    <% @Language="Javascript" %>

    <%
    var dsn="dsn=VS";
    var Conn=
    Server.CreateObject("ADODB.Connection");
    Conn.Open(dsn);


    var no_vot = Request.Form("novot");
    var thn = Request.Form("tahun");
    var peruntukanthnn = Request.Form("peruntukan");
    var tmbh = Request.Form("ptambahan");
    var total = peruntukanthnn+tmbh;





    var sql = "Insert into KE (NOVOT, TAHUN, PERUNTUKAN, ANGGARANT, TOTAL) VALUES ('"+no_vot+"','"+thn+"','"+peruntukanthnn+"', '"+tmbh+"', '"+total+"');"

    Conn.Execute(sql);
    Conn.Close();
    Conn=null;

    %>


    <HTML>

    <HEAD>
    <TITLE>JUMLAH PERUNTUKAN TAHUNAN</TITLE>
    </HEAD>

    <link rel="stylesheet" type="text/css" href="images181/blue.css">

    <BODY BGCOLOR="#000000">

    <CENTER>
    <IMG SRC="banner.jpg">
    </cENTER>

    <BR>
    <BR>
    <BR>
    <BR>
    <BR>
    <BR>

    <FONT face="Verdana,Tahoma" COLOR="white">

    <CENTER>
    <P>Peruntukan bagi Tahun <%=Request.Form("tahun") %> ialah RM <%=Request.Form("peruntukan") %> + <%=Request.Form("ptambahan") %>
    </P>
    </CENTER>

    </FONT>



    <FONT face="Verdana,Tahoma" SIZE="3">
    <ALIGN="RIGHT">
    <BR>
    <BR>
    <P>
    <A HREF="addnew1.asp">seterusnya>>>></A>
    </P>
    </ALIGN>
    </FONT>


    <BR>
    <BR>
    <BR>

    <FONT FACE="Verdana, Tahoma" SIZE="-2" COLOR="white">
    <br>
    <CENTER>Copyright Reserved 2006</a>
    </CENTER>
    </FONT>



    </BODY>
    </HTML>


    please help....
    Reply With Quote
      #6  
    Old 02-21-2006, 09:06 PM
    hally hally is offline
    Registered User
     
    Join Date: Feb 2006
    Posts: 13
    i had do what u had suggestion.. but i had face a problem....


    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '2000',20002000''.
    /SYSTEM VOT/viewperuntukan1.asp, line 21


    i had try to solve it but still having a same problem... help me..
    Reply With Quote
      #7  
    Old 02-21-2006, 09:20 PM
    hally hally is offline
    Registered User
     
    Join Date: Feb 2006
    Posts: 13
    i had correct the mistakes but now i had face this problem... before this i had face the same problem too...i dont know why.. i had re-check and re-write but the problem is still at the same place.. why? i really dont understand..


    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    [Microsoft][ODBC Microsoft Access Driver] The INSERT INTO statement contains the following unknown field name: 'ANGGARANT'. Make sure you have typed the name correctly, and try the operation again.
    /SYSTEM VOT/viewperuntukan1.asp, line 21


    before this i use field name ( ANNGGARANT) as ( TAMBAHAN) but still face the same problem.. i really hope that someone can help me... please....
    Reply With Quote
      #8  
    Old 02-22-2006, 07:38 PM
    hally hally is offline
    Registered User
     
    Join Date: Feb 2006
    Posts: 13
    helo.. after re-check and re-write.. i had face this problem... please help me

    Error Type:
    Microsoft JScript runtime (0x800A01B6)
    Object doesn't support this property or method
    /SYSTEM VOT/viewperuntukan1.asp, line 16
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 12:03 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.