Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 29th, 2006, 05:01 PM
Authorized User
 
Join Date: Jan 2005
Location: ipaja, lagos, Nigeria.
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to p2ptolu Send a message via Yahoo to p2ptolu
Default ASP credit card

hello, i have a project am working on.i have designed a form and a database has been designed , i need people to login and enter their pin number into the textbox and it will trnasfer the amount tied to that pin number to another table that has the registered members profile and his money is increased , by adding the new card amount to the existing amount.

Simply put i want to be able to use ASP to transfer numbers from a table to another table.
this is the code i used below.

<%@LANGUAGE="VBSCRIPT"%>

<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="sign_in.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
         (InStr(1,MM_authorizedUsers,Session("MM_UserAuth orization"))>=1) Then
    MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<%
Dim rst
Dim rst_numRows
Dim updateaction
Dim bet

Set rst = Server.CreateObject("ADODB.Recordset")
rst.ActiveConnection = MM_cnn_STRING
rst.Source = "SELECT * FROM personal,card"
rst.CursorType = 0
rst.CursorLocation = 2
rst.LockType = 2
rst.Open()


rst_numRows = 0
%>


<%

bet = request.Form("textfield")

response.Write(bet)
'response.End()
            
updataction = "UPDATE card SET card.amount = card.amount + '20' WHERE (card_id = '1') SET card.status = 'no'"


'updataction = "UPDATE personal SET personal.amount = personal.amount + card.amount WHERE pin = ' " & request.form("textfield") & " ' "


' strSQL = "SELECT FirstName, LastName, SSN, Salary" "FROM Employee " "WHERE LastName LIKE '%" & Request("LastName") & "%'"


'rst("personal.amount") = rst("personal.amount") + request.Form("textfield")
'rst("personal.amount") = rst("personal.amount") + bet

'rst.update
Response.Write("updateaction")
'response.End()
%>

<html>
<head>
<title>default</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/sheet.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {
    color: #990000;
    font-weight: bold;
}
.style2 {color: #990000}
-->
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="758" height="520" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
    <tr>
        <td height="146" colspan="3"></td>
    </tr>
    <tr>
        <td rowspan="4" valign="top" bgcolor="#BFAE80"><table width="169" border="0" cellspacing="0" cellpadding="0">
         <tr>
            <td height="32" bgcolor="#BFAE80"><strong>MY ACCOUNT</strong></td>
         </tr>
        </table>
         <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
             <td height="287" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="leftlinks">

                <tr>
                 <td width="92%"><div align="center"></div></td>
                </tr>

                <tr>
                 <td height="19" class="leftboxlink"><a href="myaccount.asp">My Transaction </a> <img src="images/arrow.gif" width="10" height="10"></td>
                </tr>
                <tr>
                 <td height="77" valign="top" class="sublinks"><br>
                    Add amount <img src="images/block.gif" width="10" height="10"><br>
                    Transaction history <img src="images/block.gif" width="10" height="10">
                 </td>
                </tr>
                <tr>
                 <td class="leftboxlink"><a href="#">What is Online Billing</a> <img src="images/arrow.gif" width="10" height="10"></td>
                </tr>
                <tr>
                 <td class="leftboxlink"><a href="#">My Latest Online Bill</a> <img src="images/arrow.gif" width="10" height="10"></td>
                </tr>
                <tr>
                 <td class="leftboxlink"><a href="#">See an Online Bill</a> <img src="images/arrow.gif" width="10" height="10"></td>
                </tr>
                <tr>
                 <td class="leftboxlink">Direct Debit <img src="images/arrow.gif" width="10" height="10"></td>
                </tr>
                <tr>
                 <td class="leftboxlink">How &amp; Where To Pay <img src="images/arrow.gif" width="10" height="10"></td>
                </tr>
                <tr>
                 <td class="leftboxlink">Any Questions? <img src="images/arrow.gif" width="10" height="10"></td>
                </tr>
             </table></td>
            </tr>
         </table></td>
        <td rowspan="4" valign="top"><table width="404" height="333" border="0" cellpadding="0" cellspacing="0">
         <tr>
            <td height="333"><table width="100%" border="0" cellspacing="0" cellpadding="0">
             <tr>
                <td height="374" valign="top"><table width="391" border="0" align="center" cellpadding="0" cellspacing="0">
                 <tr>
                    <td>&nbsp;</td>
                 </tr>
                 <tr>
                    <td width="377"><table width="396" border="0" cellpadding="0" cellspacing="0" class="tableborder">
                     <tr>
                        <td width="386">Welcome,<span class="style2"><strong><%=(rst.Fields.Item("name") .Value)%></strong></span>, &nbsp;&nbsp; You registered on <span class="style1">
                         <%=(rst.Fields.Item("registertime").Value)%></span></td>
                     </tr>
                    </table></td>
                 </tr>
                </table>
                 <br>
                 <table width="364" border="0" align="center" cellpadding="2" cellspacing="2" class="tableborder">
                 <tr>
                    <td height="309" valign="top"><table width="354" border="0" cellspacing="0" cellpadding="0">
                     <tr>
                        <td width="107" rowspan="2"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                         <tr>
                            <td height="123">&nbsp;</td>
                         </tr>
                        </table></td>
                        <td width="247" height="23"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="boxheading">
                         <tr>
                            <td height="23">ACCOUNT SUMMARY </td>
                         </tr>
                        </table></td>
                        </tr>
                    
                    
                     <tr>
                        <td valign="top"><table width="100%" height="74" border="1" cellpadding="0" cellspacing="0" bordercolor="#BFAE80">
                         <tr>
                            <td width="37%">Account</td>
                            <td width="63%"><%=(rst.Fields.Item("amountdue").Value )%></td>
                         </tr>
                         <tr>
                            <td>Date</td>
                            <td>&nbsp;</td>
                         </tr>
                         <tr>
                            <td>Amount Due </td>
                            <td> Naira </td>
                         </tr>
                         <tr>
                            <td>Date Due </td>
                            <td><%=(rst.Fields.Item("duedate").Value)%></td>
                         </tr>
                        </table></td>
                     </tr>
                    </table><br>
                     <table width="96%" border="0" cellpadding="0" cellspacing="0" class="boxheading">
                        <tr>
                         <td>Add amount </td>
                        </tr>
                     </table>
                    
                     <p>&nbsp;</p>
                     <table width="96%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                         <td height="115"><form name="form1" action="<%=Updateaction%>" method="post">
                            <table width="96%" border="1" align="center" cellpadding="1" cellspacing="2" bordercolor="#BFAE80">
                             <tr>
                                <td width="37%">Amount in Card </td>
                                <td width="52%"><label>
                                 <label> Naira </label></td>
                                <td width="11%">&nbsp;</td>
                             </tr>
                             <tr>
                                <td>Amount in account</td>
                                <td><label></label></td>
                                <td>&nbsp;</td>
                             </tr>
                             <tr>
                                <td>Enter PIN here </td>
                                <td><input name="textfield" type="text" class="textboxred"></td>
                                <td>&nbsp;</td>
                             </tr>
                             <tr>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                             </tr>
                             <tr>
                                <td>&nbsp;</td>
                                <td><input name="Submit" type="submit" class="button" value="Submit"></td>
                                <td>&nbsp;</td>
                             </tr>
                             <tr>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                             </tr>
                             <tr>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                             </tr>
                            </table>
                        
                         </form>
                         </td>
                        </tr>
                     </table>
                     <p>&nbsp;</p></td>
                 </tr>
                </table></td>
             </tr>
            </table>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p> </td>
         </tr>
        </table></td>
        <td height="53" bgcolor="#BFAE80">&nbsp;</td>
    </tr>
    <tr>
        <td height="32">
            <img src="images/default_05.gif" width="186" height="32" alt=""></td>
    </tr>
    <tr>
        <td height="67" bgcolor="#BFAE80">&nbsp;</td>
    </tr>
    <tr>
     <td height="205" valign="top" bgcolor="#003366">&nbsp;</td>
    </tr>
    <tr>
        <td colspan="3">
            <img src="images/default_08.gif" width="758" height="17" alt=""></td>
    </tr>
</table>

</body>
</html>
<%

rst.Close()
Set rst = Nothing
%>
Reply With Quote
  #2 (permalink)  
Old March 29th, 2006, 07:37 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

thanks for sharing your entire page with us. What exaclty is your problem?

FYI: To get the best out of a forum just post problematic code, what you think the problem is (if possible), the exact un-friendly HTTP error including line number etc.....

Wind is your friend
Matt
Reply With Quote
  #3 (permalink)  
Old March 29th, 2006, 08:33 PM
Authorized User
 
Join Date: Jan 2005
Location: ipaja, lagos, Nigeria.
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to p2ptolu Send a message via Yahoo to p2ptolu
Default

<%
Dim rst
Dim rst_numRows
Dim updateaction
Dim bet

Set rst = Server.CreateObject("ADODB.Recordset")
rst.ActiveConnection = MM_cnn_STRING
rst.Source = "SELECT * FROM personal,card"
rst.CursorType = 0
rst.CursorLocation = 2
rst.LockType = 2
rst.Open()


rst_numRows = 0
%>


<%

%>

this is the append query that inserts the amount 500 where pin is 111 to personal.amount , the card table has the following fields, id,money,PIN while the personal has the personal details and also amount.


INSERT INTO personal ( amount )
SELECT card.money
FROM card
WHERE (((card.money)=[500]) AND ((card.pin)=[111]));


below is the update query that sets the status of the card to yes if it has been used.

UPDATE card SET card.status = "yes"
WHERE (((card.card_id)=[card_id]) AND ((card.pin)=[p]));

Please where do i place this codes in my application.




Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
smart card reader on client using asp.net mkmustafa ASP.NET 2.0 Professional 3 July 4th, 2007 01:11 PM
Credit Card Processor stu9820 ASP.NET 1.0 and 1.1 Basics 3 June 22nd, 2007 02:51 PM
ASP Shopping card problem - Urgent please hugoscp Classic ASP Professional 1 June 12th, 2007 06:42 PM
Credit Card Encryption jemacc SQL Server 2000 13 October 23rd, 2006 08:45 PM



All times are GMT -4. The time now is 11:56 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.