473,385 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Error when user submits form with ; in value

I have a function that hashs the value that a user entered in a text
box and stored that hash value as a password. All is well unless a
user enters a password that when hased has a ; in it.

If a user entered 33333333 as the password my hash function returns a
value that includes a ; and then the DoCmd.RunSQl fails.

Is there a good way of fixing this? Since it is a hash of the password
I was thinking of maybe just running a function that replaces the ;
with another character before saving the value into the database.

my question is what would be the best way to do this? Also are there
any characters that I need to worry about?

txtUSERPWD_NEW_HASH = HashString(txtUSERPWD_NEW)

DoCmd.SetWarnings False

DoCmd.RunSQL "UPDATE T_USER SET T_USER.USERPWD='" & txtUSERPWD_NEW_HASH
& "' WHERE T_USER.USERID='" & txtUSERID & "' ;"
DoCmd.SetWarnings True

Nov 13 '05 #1
3 1346
td*******@yahoo.com wrote:
I have a function that hashs the value that a user entered in a text
box and stored that hash value as a password. All is well unless a
user enters a password that when hased has a ; in it.

If a user entered 33333333 as the password my hash function returns a
value that includes a ; and then the DoCmd.RunSQl fails.

Is there a good way of fixing this? Since it is a hash of the password
I was thinking of maybe just running a function that replaces the ;
with another character before saving the value into the database.

my question is what would be the best way to do this? Also are there
any characters that I need to worry about?

txtUSERPWD_NEW_HASH = HashString(txtUSERPWD_NEW)

DoCmd.SetWarnings False

DoCmd.RunSQL "UPDATE T_USER SET T_USER.USERPWD='" & txtUSERPWD_NEW_HASH
& "' WHERE T_USER.USERID='" & txtUSERID & "' ;"
DoCmd.SetWarnings True


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Using Access 2002 (ANSI-92 SQL) I couldn't replicate the error. Here's
what I did:

strPWD = HashString(Me!txtUSERPWD_NEW)

strSQL = "UPDATE T_USER SET USERPWD='" & strPWD & "'" & _
"WHERE USERID='" & Me!txtUSERID & "'"

CurrentDb.Execute strSQL, dbFailOnError

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQhk/Q4echKqOuFEgEQIBiACeOXO+9r3T0G4qPejpJ0FSamp3X0wAmw XV
Hfzj4h5JniT5yowQNujo1MHS
=qaLx
-----END PGP SIGNATURE-----
Nov 13 '05 #2
I tried modifying the code so that the ' was moved out inside a
seperate set of " "

However, I still run into the same issue where when
txtUSERPWD_NEW_HASH contains a ;

This makes sense as a ; ends a line of SQL code.
T_USER.USERPWD='" & txtUSERPWD_NEW_HASH & "'" & "WHERE T_USER.USERID='"
& txtUSERID & "' ;"

Nov 13 '05 #3
then you could, I suppose, open an updatable recordset with just one
record in it and do this...

rs.Open "..."
rs.Edit
rs.Fields("Password")=HashString(Me!txtUSERPWD_NEW )
rs.Update

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Varad | last post by:
Hi all Pls give me some insight as to what I should be doing. I have a form where I have 20 text boxes and when an user submits the form I save it to a database. When they want to retrieve it, I...
2
by: SmittyBroham | last post by:
Hello, I have a function that loops through 2 select lists and records the values of any hi-lighted options a user would have selected. It then sets 2 corresponding "hidden" form elements to the...
1
by: Andy Kasotia | last post by:
I have an ASP UI with VB Dll as a COM object that access the DB2 Database. I have a "Calculate" button on the ASP Page which when clicked does form validation (javascript) and submits the form...
8
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and...
2
by: Luke | last post by:
Hi I have the following code which is an ASP questionnaire using an Access database. (I am using access as I have no choice!). Basically there is an html form which submits the form to the page...
3
by: Taras_96 | last post by:
Hi everyone, I've got a rather unconventional architecture that I'm having problems with... I have a form called "searchForm", that has an input of type "submit" (with name = "submitButton...
4
by: roman | last post by:
Hi, I have a form which validates data before submitting, it catches the error, but still submits and can't seem to figure out why. Can someone look at my code and give me some ideas how to...
6
by: rn5a | last post by:
During registration, users are supposed to enter the following details: First Name, Last Name, EMail, UserName, Password, Confirm Password, Address, City, State, Country, Zip & Phone Number. I am...
1
by: Sudarhan | last post by:
Hello frnds I have created a webbased form using asp and javascript .. while submitting the form i am validating the fields in the form .it validates the field and returns alert message. but when...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.