C# - Luhn Check Digit / Produces 2 Length Check Digit Values?
Jun 26, 2010
I cant seem to figure out what is wrong with my check digit code!
At times, it produces 2 length check digit values
Example
1277531815000110 <-- check digit is double value??????
1277532495000110 <-- check digit is double value???????
1277534649000110 <-- check digit is double value???????
127753185300011 <-- good!
127753208500019 <-- good!
All generated numbers are valid, it can be checked at http://www.ee.unb.ca/cgi-bin/tervo/luhn.pl?N=127753224800013
CODE: http://tinyurl.com/352acpj
View 1 Replies
Similar Messages:
Jan 11, 2011
Could anyone please give me some code to generate Check Digit base on LUHN formula. Suppose i pass 15 digit of credit card number then fuction should calculate and generate the Check Digit.I found some link but it is MS SQL function and i tried it work well except if check digit is 0 it will return 1 so i get confused, because some time Check Digit is also 1 so in both cause this function returning 1.http://www.codeproject.com/Tips/120472/SQL-function-to-verify-Check-Digit-of-given-VISA-M.aspxI will appreciate if some one can give me VB code.
View 1 Replies
Dec 12, 2010
I need to generate 8 digit unique id in c#. On my site a user will register and I need to generate a unique id for him in c# code(I don't want this logic in DB), after inserting the id I need to save it in database.
Edit: I need that numbers to be generated in random manner everytime.
View 6 Replies
Mar 7, 2010
I want to generate a 16 digit random account number that should be unique in database for every new user of my website. kindly guide me how can i generate a 16 digit unique number.obviouly i understand that i would have to check that number in my database table for uniqueness and if that generated number already exist then i would have to generate it again.
View 11 Replies
Feb 11, 2010
When I read an integer, I cannot display it as a ### digit ..
code:
[Code]....
View 3 Replies
Jun 26, 2010
I want a number that would be unique forever, I came up with the following code,
it generates a number and adds a check digit to the end of it, I would like to know how reliable is this code?
public void GenerateUniqueNumber(out string ValidUniqueNumber) {
string GeneratedUniqueNumber = "";
// Default implementation of UNIX time of the current UTC time
TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
string FormatedDateTime = Convert.ToInt64(ts.TotalSeconds).ToString();
string ssUniqueId = DateTime.UtcNow.ToString("fffffff");.......
EDIT: clarification GUID can not be used, the number will need to be entered into a IVR system via telephone keypad.
View 10 Replies
Jan 10, 2011
Is there a function in .net that will take a number such as 134,501 and convert it to time? That time would be 1:45:01 pm. I was hoping i didn't have to reinvent the wheel for this.
View 1 Replies
Nov 15, 2010
I have a dropdown list which has items bound to it using sql datasource.
In the database i have the numeric values corresponding to each item.
Now there are many such dropdown list's and on selection of each item i want to form a 14 digit numeric code,which i need to use further for some more functionality.
How can i convert a selected item from a dropdownlist to a numeric digit??or how can i bind the items in the dropdownlist to a database having numeric value for each item?
E.g if i select 'WT' from dropdown list the corresponding value for it in the database table is 39 so on form submit i want '39' to be formed in codebehind. likewise on selection of all items from different dropdown list the digit formed using codebehind should be '15487523568955'
View 2 Replies
Nov 23, 2010
I am using C# 2.0 and ASP.NET.
How to create 4 digit Sequential Number (0001 to 9999).
I have a web page, where students save their information. When the students submit the page, I want to add the string "Stu" followed by the 4 digit sequence number. The sequence number should be unique. The sequence number should increment to the next sequence, when a new record is getting added.
How to achieve this?
View 1 Replies
Jan 28, 2011
how to set the validation expression for digit with point?
example: 0.25, 0.3, 0.006, 0.5 ???
d+$
View 4 Replies
Jan 12, 2010
I want to check if two string are of the same length. I tried the following, but it doesn't work.
string passnew = "1233";
string passcnfrm = "1234";
if((passnew.Length&&passcnfrm.Length)>6 ||(passnew.Length&&passcnfrm.Length)<15)
{
// ...
}
Why does it not work? What do I need to change?
View 6 Replies
Nov 25, 2010
In my table in the DB, I have these data types for some of its columns..
Address1 nvarchar(200)
Address2 nvarchar(200)
City nvarchar(200)
State nvarchar(200)
Now in my aspx page I need to display this data in text boxes. What should be the max length for the text boxes for Address1 text box, Address2 textbox, City's text box and state's according to what I have in my DB ?
How do I apply the max length validation check on these text boxes in my page ?
View 2 Replies
Jan 27, 2010
in my web application i want to validate that user can enter only digits and the digit may be a integer or decimal how can i write the regular expression for this.
View 2 Replies
May 22, 2010
I am working on a website. I am using C# 2008. I want to make a text box that accept only numbers & comma(,). for example-919981424199,78848817711,47171111747 or there may be a single number like 919981424199.
I was able to do one thing My text box only containing number by using this Regular Expression validation.in its property->Validation Expression i wrote "[0-9]+". This is working but now my requirement is to send bulk SMS & each number is separated by (,).
View 2 Replies
Jan 19, 2010
We have a spreadsheet that has a Zip column. These zip has a plus 4 digit in this format 99999-9999. When I looked at the format of this cell, it was a Special format with Zip+4 type. I just need to get the 5 digit zip code but the problem I am running into is the leading 0s. I tried =LEFT(A2, 5) but this trims the leading 0s. I also tried highligiting the column, then DATA -> Text to Columns -> Delimeter with hyphen but that didn't work. Is there any other way to do this or am I missing something on my first two attempts. Please let me know if you need more clarifications.
View 4 Replies
Jan 4, 2011
I had a 14 digit create datetime and resolved datetime in float time format and I could parse the date using following conversion:
CONVERT(datetime, LEFT(CAST(CAST(is_resolved_datetime as BigInt) as varchar(14)),8)+' '+
SUBSTRING(CAST(CAST(is_resolved_datetime as BigInt) as varchar(14)),9,2)+':'+
SUBSTRING(CAST(CAST(is_resolved_datetime as BigInt) as varchar(14)),11,2)+':'+
SUBSTRING(CAST(CAST(is_resolved_datetime as BigInt) as varchar(14)),13,2))
If I were to extract only the time difference of two datetimes in hr:min:sec.
View 7 Replies
Dec 9, 2010
I have a project that I have to import a text file. comma delimited values, into an Access 2010 database...I am experiencing a big problem that I have no idea how to work. I have two fields in the file that are 13 digit numbers... all my columns in the table are Text (255) yet this 13 digit number is causing the Data connection to close instantly with no data saved.When I look at the data in Excel it looks like this...4.76334E+15 in Notepad 4763341000002623 (the true and correct value).If I use Access import text tool in Append mode the table it crashes. If I use the same tool but this time tell it to create a NEW table it works.Error Msg...Microsoft Access was inanble to append all the data to the table.
The contents of fields in 0 records were deleted, and 0 records were lost due to key violations.*If data was deleted, the sata you pasted or imported doesn't amtch the field data types or the fieldSize property in the destination table.*If records were lost, either the records pasted contain primery key values that already exist in the destination table, or they violate referential integrity rules for a relationship defined between tables.Do you want to proceed anyway?Why is Access crashing and what can I do to resolve the problem?
View 3 Replies
Jun 28, 2010
I have one textbox, in which I want allows to enter value like
1, 1.5, 2, 2.5, 3, 3.5, 10, 10.5....
That means user can enter only 1 digit after decimal and it is restricted to .5 only, not .25 ot .34 or .75
Let me know how can I do this?
View 8 Replies
Nov 18, 2010
If in the label the default text is 10 then ten textbox controls will be generated in webform ...
Can anybody did this in VB.NET ?
View 1 Replies
Sep 20, 2010
I want to modify my userAvailabilityCheck code and want to add the code that this userAvailabilityCheck function does not fire If the textbox is null or having character less than 6 but display related error message.
Below is my code-
[Code]....
As you can see in the above code, I have added if else code in my working code but after the addition of these checkers my code stops working.
View 6 Replies
Dec 1, 2010
How can I generate a 7-digit random number and special character string in a textbox on a button click event, in VB.Net?
View 2 Replies
Mar 1, 2011
I want to display a number to words. for eg : RO 70.357 should display as "Seventy Rials and three hundred fifty seven baiza" because in Oman currency is of 3 decimal digits.
My question is below
When I used truncate function to get the decimal value it returning with 2 decimal digits. eg: 70.36 (357 is rounded to 36)
I want to display exact digits without rounding a decimal value.
View 1 Replies
Nov 9, 2010
i have a asp.net aspx page, which references a css file,have the font size defined in css as 2em;
want to give option to user to change this to any value he wishes
irrespective of the bad effect to display format
question, ways to achieve it easily, efficiently and the most simplest way possible
note,way should support all browsers
View 2 Replies
Nov 16, 2010
Im upload a file using file upload control and for unique identificaton
we use system.io.file.GetCreationTime(Path).Tofilename()
In local system the file is inserted in to the table and local folder - with 18 digitnumber +filename.
But after publishing, when we run, the files are inserted into the table without the 18 digit and error occured.
View 5 Replies
Apr 27, 2013
I want to add verification of user by sending 6 digit code to his mobile number during registration. Any way how can i do this.
View 1 Replies