Case Sensitivity

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: May 2007
Posts: 537
Reputation: choudhuryshouvi is an unknown quantity at this point 
Solved Threads: 49
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro

Re: Case Sensitivity

 
0
  #11
Jan 24th, 2009
you have done some mistakes in the code....do the modifications as I mentioned...

in the function definition change
rst.Open "select * from event where eventname='" & Trim(txtEName) & "'", gcn

to the following ...
rst.Open "select * from event where eventname='" & Trim(evtName) & "'", gcn

in your cmdAdd_click() change the entire code...like the following...

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub cmdAdd_Click()
  2. dim rst as New ADODB.Recordset
  3.  
  4. on error goto chec
  5.  
  6. If IsEventExists(txtEName.Text) = True Then
  7. MsgBox "Event Name Already Exist. Type a new one", vbInformation, "Duplicate Event"
  8. txtEName.SetFocus
  9. exit sub
  10. endif
  11.  
  12. rst.CursorLocation = adUseClient
  13. rst.CursorType = adOpenDynamic
  14. rst.LockType = adLockOptimistic
  15.  
  16. if rst.state=adstateopen then rst.close
  17. set rst=nothing
  18.  
  19. rst.open "select * from event",con,1,2
  20. rst.AddNew
  21.  
  22. rst!fnumber = StrConv(txtFNumber, vbProperCase)
  23. rst!eventname = StrConv(txtEName, vbProperCase)
  24. rst!fname = StrConv(txtFName, vbProperCase)
  25. rst!fincharge = StrConv(txtFIncharge, vbProperCase)
  26. rst!fschedules = StrConv(Text2, vbProperCase)
  27. rst!fschedulee = StrConv(Text3, vbProperCase)
  28. rst!sitcapacity = StrConv(txtCapacity, vbProperCase)
  29. rst!userschede = StrConv(Combo4, vbProperCase)
  30. rst!userscheds = StrConv(Combo3, vbProperCase)
  31. rst!fuser = StrConv(txtFUser, vbProperCase)
  32. rst!destination = StrConv(txtDestination, vbProperCase)
  33. rst!condition = StrConv(cboCondition, vbProperCase)
  34. rst!enddate = dtpDate(0).Value
  35. rst!startdate = dtpDate(0).Value
  36. rst!transaction = StrConv(cboTransaction, vbProperCase)
  37. rst!fsh = StrConv(txtfsh, vbProperCase)
  38. rst!ush = StrConv(txtush, vbProperCase)
  39.  
  40. rst.Update
  41. if rst.state=adstateopen then rst.close
  42. set rst=nothing
  43.  
  44. Label20.Caption = "Successfully Saved. . ."
  45. Call dload2
  46.  
  47. exit sub
  48.  
  49. chec:
  50. err.clear
  51. msgbox "some error occured..."
  52. txtEName.SetFocus
  53. exit sub
  54. End Sub

try this and get me your feed...

regards
Shouvik
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 24
Reputation: kain_mcbride is an unknown quantity at this point 
Solved Threads: 3
kain_mcbride's Avatar
kain_mcbride kain_mcbride is offline Offline
Newbie Poster

Re: Case Sensitivity

 
0
  #12
Jan 24th, 2009
Originally Posted by nagatron View Post
Please help me how to ignore case sensitivity in VB. My program is to store data in the database, though I use small letters or big letters, the database store the data starting with a capital letter followed by small letters. Ex.

Input: Neil, neil, NEIL

In the database: Neil

So if I input Neil, the program response is ok but if I input neil or NEIL, the program results an error in the database and the program exits.

Please I need your kind help. Thank you so much.

Regards,
Neil
hi

try formatting the data before actually submitting it to the database initially... its been a fairly long time since i've done that much with formatting text in visual basic, so i'm not really sure if there's a default way to force name style capitalization of words, but either way... you could do it like this...

  1. Private Function PropperName(stDATA As String) as String
  2. 'holds returned word array, just incase ya know?
  3. Dim stWords() As String
  4. 'just a loop variable
  5. Dim iLoop As Integer
  6.  
  7. 'split the submitted data into individual words, after setting
  8. 'all characters to lower case
  9. stWords = getWords(LCase(stDATA))
  10. 'loop the words, set them the first character to upper case
  11. For iLoop = LBound(stWords) To UBound(stWords)
  12. Mid$(stWords(iLoop), 1, 1) = UCase$(Left$(stWords(iLoop), 1))
  13. Next iLoop
  14.  
  15. PropperName = Join(stWords, " ")
  16. End Function
  17.  
  18. Private Function getWords(stDATA) As String()
  19. getWords = Split(stDATA, " ", , vbTextCompare)
  20. End Function

keeping in mind that the getwords isn't really needed, but if your user enters the name NEIL NORBERT - for instance - then it would submit Neil Norbert to the database, vs Neil norbert

hope that helps

[edit]
ok, so i didn't notice the vbPropperCase in StrConv before :"> but this is a good way to do it if you don't want to use the built in way - lol
[/edit]
Last edited by kain_mcbride; Jan 24th, 2009 at 9:09 pm. Reason: ... explained... :P
... there is no bug that enough coffee cannot fix...
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 537
Reputation: choudhuryshouvi is an unknown quantity at this point 
Solved Threads: 49
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro

Re: Case Sensitivity

 
0
  #13
Jan 25th, 2009
Hello.......i have attached the sample code...
just check this out....and get me your feedback...

hope this will be useful for you...

regards
Shouvik
Attached Files
File Type: zip Sample.zip (12.2 KB, 4 views)
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 77
Reputation: nagatron is an unknown quantity at this point 
Solved Threads: 0
nagatron nagatron is offline Offline
Junior Poster in Training

Re: Case Sensitivity

 
0
  #14
Jan 26th, 2009
hallo friend, I have tried your code about the case sensetivity. I works great but there's a little bit problem. If I input like this:

Input1:
Event Name: Fieldtrip --------------------> (primary key)
User: Neil
Schedule: 1/20/09

Input2:
Event Name: Tour --------------------> (primary key)
User: Neil
Schedule: 1/20/09

Where the event name is my primary key in the database. It results an error if "User" and "Schedule" in input1 and input2 are the same. I was expecting that there will be no error coz my primary key is "Event Name" not the user or schedule. "some error occured..." this message will appear. But if I input another entry in input2 like:

Input2:
Event Name: Tour --------------------> (primary key)
User: James
Schedule: 1/21/09

This works fine.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 77
Reputation: nagatron is an unknown quantity at this point 
Solved Threads: 0
nagatron nagatron is offline Offline
Junior Poster in Training

Re: Case Sensitivity

 
0
  #15
Jan 26th, 2009
By the way, thank you so much for the sample. I will give the feedback. I will try to study your code. As soon as I finished it, I will share the program to you if you want. It is for my thesis. hehehe thanks. . .
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 77
Reputation: nagatron is an unknown quantity at this point 
Solved Threads: 0
nagatron nagatron is offline Offline
Junior Poster in Training

Re: Case Sensitivity

 
0
  #16
Jan 26th, 2009
These are the errors I see in the sample you sent to me. I was not able to view the running part. =) I will try to understand your code.
Attached Files
File Type: zip error.zip (113.6 KB, 1 views)
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 537
Reputation: choudhuryshouvi is an unknown quantity at this point 
Solved Threads: 49
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro

Re: Case Sensitivity

 
0
  #17
Jan 26th, 2009
Originally Posted by nagatron View Post
These are the errors I see in the sample you sent to me. I was not able to view the running part. =) I will try to understand your code.
what did you mean by this --->
I was not able to view the running part
did u mess up with vb???....it seems that some of your activex files (.ocx) are missing.....the snaps that you are attached are fully system related....these are not related to the program at all....to avoid getting this error you have the following options :-

1. uninstall and then re-install vb
2. just register "mscomctl.ocx" and "mscomct2.ocx" in your system...
might be you are not familer with registering activex controls manually...so i'm giving you the steps :-

1. if you haven't yet messed up with vb, you will have these two ocx files in your "system32" directory of your root drive..
2. use the command --> regsvr32 <ocx file name> to register the files...like to register "mscomctl.ocx" you must type....

regsvr32 mscomctl.ocx....similarly....for the other one
regsvr32 mscomct2.ocx..........issue this command from start->run

just register these two ocx files and the errors will be simultaneously solved....

if you donot have these files...just download from net....these are freely distributable and available for download...

regards
Shouvik
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 537
Reputation: choudhuryshouvi is an unknown quantity at this point 
Solved Threads: 49
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro

Re: Case Sensitivity

 
0
  #18
Jan 26th, 2009
Originally Posted by nagatron View Post
hallo friend, I have tried your code about the case sensetivity. I works great but there's a little bit problem. If I input like this:

Input1:
Event Name: Fieldtrip --------------------> (primary key)
User: Neil
Schedule: 1/20/09

Input2:
Event Name: Tour --------------------> (primary key)
User: Neil
Schedule: 1/20/09

Where the event name is my primary key in the database. It results an error if "User" and "Schedule" in input1 and input2 are the same. I was expecting that there will be no error coz my primary key is "Event Name" not the user or schedule. "some error occured..." this message will appear. But if I input another entry in input2 like:

Input2:
Event Name: Tour --------------------> (primary key)
User: James
Schedule: 1/21/09

This works fine.
can you upload your database(only) here...so that i can investigate.....according to the code...there is not a single line of error at all....i have tested it several times....but i tested it with a sample database....ofcourse your db structure is 100% diff. than this...so if you give me the actual database i can check for the error more thoroughly........now the choice is yours...

btw thanks for using the code and for urs feedback...

regards
Shouvik
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 537
Reputation: choudhuryshouvi is an unknown quantity at this point 
Solved Threads: 49
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro

Re: Case Sensitivity

 
0
  #19
Jan 26th, 2009
okk......check out this code now...
i think this time it is 100% OK...

regards
Shouvik
Attached Files
File Type: zip Sample.zip (12.5 KB, 4 views)
Shouvik_The_Expert_Coder
Have a problem? Don't worry just give me a call and I'll fix it for you.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 77
Reputation: nagatron is an unknown quantity at this point 
Solved Threads: 0
nagatron nagatron is offline Offline
Junior Poster in Training

Re: Case Sensitivity

 
0
  #20
Jan 27th, 2009
sure, I will show it to you today. . .=) thank you =)
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC