473,396 Members | 2,139 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,396 software developers and data experts.

Storing a persistent value

Hi,
I'm working on an Access database which eventually be connected to an
ODBC data source (probably postgres), but for now has an .mdb backend.
The idea is to use the password to authenticate with postgres when we go
to it. I'm using the ebCrypt library to md5 hash passwords and store
them hashed in a password table.

For the moment I would like to use this system to authenticate without
dealing with Access security. I have written functions that check the
password against the password table and set values showing who is
authenticated. The problem is that whenever an error is raised, if the
user chooses the End button, the "project" memory is cleared and the
user appears to no longer be authenticated. Can anyone tell me how to
make these values persist until Access is closed?

Thanks,

Eric
Nov 12 '05 #1
2 2231
Eric Ellsworth wrote:
Hi,
I'm working on an Access database which eventually be connected to an
ODBC data source (probably postgres), but for now has an .mdb backend.
The idea is to use the password to authenticate with postgres when we go
to it. I'm using the ebCrypt library to md5 hash passwords and store
them hashed in a password table.

For the moment I would like to use this system to authenticate without
dealing with Access security. I have written functions that check the
password against the password table and set values showing who is
authenticated. The problem is that whenever an error is raised, if the
user chooses the End button, the "project" memory is cleared and the
user appears to no longer be authenticated. Can anyone tell me how to
make these values persist until Access is closed?


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

When an unhandled error occurs & the user clicks the "End" button on the
Error notification message box the global variables' values are cleared.
To avoid the clearing of variables you need to write some error
handling routines in all procedures that will cause an error. The
easiest is this:

Put this line at the beginning of a procedure, before any program lines:

On Error GoTo err_

After the procedures program lines, but something like the following:

exit_:
Exit Sub ' or Function, depends on the type of procedure

err_:
MsgBox "An error occurred" & vbcr & vbcr & _
"Error: " & err.description, vbExclamation
Resume exit_

Now every time an error occurs in that procedure it will be "handled" by
the program lines under the "err_:" label, and then resume at the
"exit_:" label, which leaves the procedure. All currently loaded global
variables will not lose their values.

If you wish you can make the error MsgBox more descriptive, so you can
fix the error (bug).

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

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

iQA/AwUBQICPi4echKqOuFEgEQKkCwCfdOS/oRUv1ixixJQF0cDrBl/muIsAniEG
ioSDoz2qzwTde5ZP/C89AR+C
=iSpT
-----END PGP SIGNATURE-----

Nov 12 '05 #2
Hi MG,
Thanks for the idea to use error handling. My experience has been that
during development and initial testing, there are almost always errors
that my error handler doesn't catch, and therefore require pressing
"End" to escape the sequence. That's why I want to be able to pick up
the value from a persistent location, but have it be flushed at the end
of the Access session.

Thanks,

Eric

MGFoster wrote:
Eric Ellsworth wrote:
Hi,
I'm working on an Access database which eventually be connected to
an ODBC data source (probably postgres), but for now has an .mdb backend.
The idea is to use the password to authenticate with postgres when we
go to it. I'm using the ebCrypt library to md5 hash passwords and
store them hashed in a password table.

For the moment I would like to use this system to authenticate without
dealing with Access security. I have written functions that check the
password against the password table and set values showing who is
authenticated. The problem is that whenever an error is raised, if
the user chooses the End button, the "project" memory is cleared and
the user appears to no longer be authenticated. Can anyone tell me
how to make these values persist until Access is closed?

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

When an unhandled error occurs & the user clicks the "End" button on the
Error notification message box the global variables' values are cleared.
To avoid the clearing of variables you need to write some error
handling routines in all procedures that will cause an error. The
easiest is this:

Put this line at the beginning of a procedure, before any program lines:

On Error GoTo err_

After the procedures program lines, but something like the following:

exit_:
Exit Sub ' or Function, depends on the type of procedure

err_:
MsgBox "An error occurred" & vbcr & vbcr & _
"Error: " & err.description, vbExclamation
Resume exit_

Now every time an error occurs in that procedure it will be "handled" by
the program lines under the "err_:" label, and then resume at the
"exit_:" label, which leaves the procedure. All currently loaded global
variables will not lose their values.

If you wish you can make the error MsgBox more descriptive, so you can
fix the error (bug).

Nov 12 '05 #3

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

Similar topics

16
by: Paul Rubin | last post by:
I've had this recurring half-baked desire for long enough that I thought I'd post about it, even though I don't have any concrete proposals and the whole idea is fraught with hazards. Basically...
0
by: obhayes | last post by:
Hi All, Im using classic ASP (3.0) and I have a web farm with 2 webservers (webserver A and webserver B, both windows server 2003). I do not want to store any client specific information on the...
1
by: brad | last post by:
Hi, Im using classic ASP (3.0) and I have a web farm with 2 webservers (webserver A and webserver B, both windows server 2003). I do not want to store any client specific information on the...
2
by: Eric Ellsworth | last post by:
Hi, I'm working on an Access database which eventually be connected to an ODBC data source (probably postgres), but for now has an .mdb backend. The idea is to use the password to authenticate...
1
by: Marco Rispoli | last post by:
I am using this function to write a cookie: private static void SaveCookie(string CookieName, string CookieValue, bool Persistent) { HttpContext.Current.Response.Cookies.Value = CookieValue;...
0
by: Kepler | last post by:
I'm testing very basic FormsAuthentication and having trouble with non-persistent cookies. Once authenticated with a non-persistent cookie, if I leave the browser alone for 30 minutes,...
2
by: nacho222 | last post by:
I'm currently in the middle of writing a persistence framework, and I have to make a design decission. The framework will take care of all the saving and restoring objects, and also the...
0
by: robert | last post by:
I have noticed in .net 2 that when authenticating a user, setting the cookie using either redirectfromloginpage or setauthcookie, specifying true for the persistent parameter that the cookie is...
3
by: sanchita | last post by:
Hello everyone, I didn't get any response in "Security" forum hence posting here again. I am having problem with persistent cookies. Even after setting "CreatePersistentCookie" to true in...
11
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I have worked with application settings in VS2005 and C# for awhile, but usually with standard types. I have been trying to store a custom container/class/type in an application setting and I have...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.