Dropdown datasource using dataset and functions for list

W

Winshent

I am building an e commerce site.

I want to list credit customer card numbers in a dropdown list so that
the customer can select a payment method. In the DB i am storing the
last 4 CC digits as well as the length of the CC number (the CC Number
will be stored encrypted and deleted after copying to local systems).

I want to display the payment method as '**** **** **** 1234' for a
card with card number of 16 digits that was previously used for
payment.

As credit cards do not all have 16 digits, i have a function to convert
each digit to * and then add the last 4 digits on.

I want to display this in my dropdown list. Whats the best way of doing
this?

I have looked at adding a new column to a datatable and setting the
expression but i dont think it can be done.

Do i ahve to do something like create an array from a
dataset/datareader and then manipulate from there ?

Thanks

Vincent
 
U

Usarian Skiff

If it were me, I would create a string array of the numbers they have, then
loop and addrange the array to the box. You could then use the
selectedindex to keep track of the real number, perhaps in a matching array
that contains the real numbers, or position in existing dataset, etc.

Usarian
 
W

Winshent

i used this in the end.. added a column to the table and just set the
value..
dim ds as Dataset
Dim i As Integer
ds = GetData(params, SQL, "CardSummary")
Dim clm As New DataColumn("CardInfo")
clm.DataType = System.Type.GetType("System.String")
ds.Tables(0).Columns.Add(clm)

Dim dr As DataRow

For Each dr In ds.Tables(0).Rows
dr("CardInfo") = DisguiseCardNo(dr("cc_Last4"),
dr("cc_CardLen")) & " Exp." & Left(dr("cc_ExpiryDate"), 2) & "/" &
Right(dr("cc_ExpiryDate"), 2) & " (" & dr("cc_Type") & ") "
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top