How to make my program limited to 30 days? (1 Viewer)

bobtylen

New member
Local time
Today, 08:44
Joined
Jul 31, 2019
Messages
1
So i recent made a basic program in C# using visual studios
Now i want to know how to make a DB that only users with the Username and Password that i have created can acess it for limited time (30 days)
i have searched a lot about it but there isnt enough info about this
 

Micron

AWF VIP
Local time
Today, 11:44
Joined
Oct 20, 2018
Messages
3,476
About the only sure thing you can do is code the password and expiry date and make the db an accde. When the term expires and the db is purchased (if that's what this is about) you'll have to replace the part with the code (front end) if the db is split. If not split, all the data would have to be migrated to the purchased version.

Anything else you do may make it very difficult to crack but not impossible, and that depends on the level of protection you employ. It would depend on the degree to which the end user would be willing to go in order to circumvent your protection. That is a big subject.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:44
Joined
May 7, 2009
Messages
19,169
I think the section is visual basic.
 

isladogs

MVP / VIP
Local time
Today, 15:44
Joined
Jan 14, 2017
Messages
18,186

onur_can

Active member
Local time
Today, 08:44
Joined
Oct 4, 2015
Messages
180
Hi
I think a subroutine like the one below can be created. And it can be called and checked from the First Open form when opened.


Code:
Public Sub DemoControl()

Dim timecontrol As Date
timecontrol = "04/26/2020"

If timecontrol = Date Then
MsgBox "Demo Version is limited to 1 Month." & vbCrLf & _
        "Please contact the program manager", vbOKOnly + vbCritical, "Demo Version"

Application.Quit acQuitSaveNone
End If

End Sub
 
Last edited by a moderator:

Gasman

Enthusiastic Amateur
Local time
Today, 15:44
Joined
Sep 21, 2011
Messages
14,044
I was really surprised that using " with the date variable actually worked.? :unsure:
 

isladogs

MVP / VIP
Local time
Today, 15:44
Joined
Jan 14, 2017
Messages
18,186
Several comments related to the suggested code
As Gasman said, that code won't work as the date needs to be surrounded by # not ".
Also I would change the = to <= otherwise the message would only be shown on the specified date.

This should be better
SQL:
Public Sub DemoControl()

Dim timecontrol As Date
timecontrol = #4/26/2020#

If timecontrol <= Date Then
MsgBox "Demo Version is limited to 1 Month." & vbCrLf & _
        "Please contact the program manager", vbOKOnly + vbCritical, "Demo Version"

Application.Quit acQuitSaveNone
End If

End Sub

However, normally you would want the app to work for e.g. 30 days after the user first runs it. So setting a fixed date isn't a good idea.
Furthermore, unless you apply additional code to secure the app, it would be trivial to bypass such code
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:44
Joined
Sep 21, 2011
Messages
14,044
No Colin, it actually worked!. I tested it with my date format of "26/03/2020"
 

isladogs

MVP / VIP
Local time
Today, 15:44
Joined
Jan 14, 2017
Messages
18,186
I also tried it and it didn’t work for me as originally written with “” marks
 

Gasman

Enthusiastic Amateur
Local time
Today, 15:44
Joined
Sep 21, 2011
Messages
14,044
That is why it surprised me. :D

1585213801517.png
 

Users who are viewing this thread

Top Bottom