case sensitive letters...

tommyboy

Active member
Joined
Jun 21, 2005
Messages
34
Programming Experience
Beginner
hi ther,

can anyone tel me how to check whether t user input characters r exactly same as in table with sql server as backend...

im facin prob wen i retrieve data from sql server database for a gvn input...

say for example, wen t user key in employee num = pr0001 n asked for displyin tat employee's details! but in t database t employee num is PR0001..

so by right, it shldnt allow to display t PR0001's data coz t user only input pr0001..unfortunately ma current system wil enable displaying in such case!

so is tat any code to check t user in put whether it is identitical to t one in t table or not!!!
 
hi kulrom,

im afraid i cannot use that method!
This is because it's up to user when they adding new employee number as i cannot set restricts such that setting to uppercase or lower case level of inputs.the users are independently can add as the way they want!

so if they create new employee number like PR0001...
and if the user wish to update, edit or delete the corresponding details for that employee number, namely PR0001 then they should only can enter PR0001 and try perform any required operations like update and so on..


but my current system will allow the user edit or delete even when they key in pr0001 which is wrong because they should key in exactly PR0001..
any idea???:rolleyes:
 
If I understand you correctly, you will want to use the String.Compare method and specify that it should not ignore case.

VB.NET:
String.Compare(userinput, valuefromDB, false)
 
O yeah the String.Compare function seems reasonably useful in this situation ... good notice mjb3030 :)

Btw, this function returns its value as an integer, specifying what it found. There are three possible values

-1 String 1 is less than string 2
0 String 2 is equal to string 1
1 String 1 is greater than string 2

ah ... also it may happen to returns null value id String 1 and or string 2 is null

Regards ;)
 
Guyz, im stuck again...

okay , string comparing may seemed to b more reasonable but mayb i dunno how to apply in my case..<guide me plz>

okay here it sounds like this..

if i wanna use that method means i must obtain a db value n user input in t same time to make comparism rite..

but what i wanna do is that im goin to straight away get the user input and then try find an identitical one from db..

sope u guyz hv any idea what im saying?
 
Well, to be honest i'm wondering all the time why you insist on that mployee number. Why you don't match user's ID (which is unique key) and in this way identify the user? Also notice that it is bad practice to allow same values no matter do they are presented with lower or upper letters. Maybe you should consider these things? To assure you let's try to registed an eMail twice under same name i.e. 1st time let it be yourname@yahoo.com and 2nd time give it a try yoUrNAMe@yahoo.com

Regards ;)
 
ic...so ur suggesting that practising such comparism in obtaining user input level of coding is not recommended..
so do u think that i shld let users to input their desire input either lower or upper as long they are matching with the one in db is acceptable???

hmm..sounds nice to me..haha

okay, i'll shall consider it..
 
ic..

but un4tunately my system required to be such one that the user shld determine the employee number! [User here refering to administrator!!!]

but i think ill go one with that "unchecking" suggestion if my supervisor will okay with that!

neway realy thnx lot for yer help man...

thnx to mjb3030 too ...;)
 
Last edited:
Suggestion:

Write yourself a little for/next loop to convert all employee numbers to upper case. Even on a large dataset it will only take minutes to complete. Then set the company wide standard that all employee numbers be in upper case, set the input box for new employees to except only upper case and have a nice clean, consistant dataset.
It's not that big of a deal, flag duplicate records and deal with them by assigning unique id's.
 
Proper anser is to make the data base CASE sensitive!
Then it won't matter how the "admin" input the information the "user" must put it in the same way.
In a case sensitive database "pn1001" is NOT equal to "PN1001".
You also need to make sure that the field you are searching for in your data base is required to be unique.

these 2 things toget ther will mean NO code changes from your end and IS the recomended way to prevent index duplication in key tables. (of course i'm assuming your table is indexed on the field your searching)
 
Back
Top