Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return only Four Characters for a DB Field

Status
Not open for further replies.

ggrewe

IS-IT--Management
Jul 10, 2001
169
US
I have created a registration asp page and I am trying to only return the last four digits of the credit card number on the confirmation page. Whenever I change the s-column to be Right("CreditCardNumber",4) - or any variation of this, it errors. If I change any other code, it is overwritten when I save the form.

Any suggestions would be appreciated. Here is the code from Front Page.

Credit Card Number:</b>&nbsp;<!--webbot bot=&quot;DatabaseResultColumn&quot; startspan
s-columnnames=&quot;...&quot;
s-column=&quot;CreditCardNumber&quot; b-tableformat=&quot;FALSE&quot; b-hasHTML=&quot;FALSE&quot; clientside
local_preview=&quot;<font size=&quot;-1&quot;>&lt;&lt;</font>CreditCardNumber<font size=&quot;-1&quot;>&gt;&gt;</font>&quot;
preview=&quot;<font size=&quot;-1&quot;>&lt;&lt;</font>CreditCardNumber<font size=&quot;-1&quot;>&gt;&gt;</font>&quot; --><%=FP_FieldVal(fp_rs,&quot;CreditCardNumber&quot;)%><!--webbot
bot=&quot;DatabaseResultColumn&quot; i-CheckSum=&quot;42323&quot; endspan -->
 
Take a look at the bot. There may be an issue with how it is retrieving or something along those lines. If you can dump it into a variable say X try:

X = trim(strCreditCardNumber)
X = right(X,4)

If the CCnumber is delimited with say a &quot; - &quot; then you could :

X = split(CCNumber)
CCNumber = trim(X(2))

If you can get the credit card number into a varibale though then you should have no problems running the right function once you have trimmed the leadeing and trailing spaces.

Hope this helps,

Micah A. Norman

Hope this helps


 
Thanks Micah,

I am new to ASP and I am sure that I can create the variable, but how do I display it? I am doing this all within a Database results. I have had no luck replace the column names with variables so far. Thanks.
 
The snippet of code you displayed is a bit wierd. What exactly are you using to get the credit card info?
 
I am using Front Page, which is all I know at this point. Thanks for any help.
 
ggrewe I would recommend using Dreamweaver Ultra Dev, it has ASP coloring which is very nice. Frontpage only makes your code 1 color which makes it harder.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top