Good Day Everyone!. Now im trying to know more about masterkey. Ive heard that if my database[ms-access(i use oledb)] accidentally deleted or someone hack it and delete my database, they said that i should make a master key where even though my database got deleted i still can LogIn or have a access to my system. I read some articles including this one http://dotnetslackers.com/articles/sql/IntroductionToSQLServerEncryptionAndSymmetricKeyEncryptionTutorial.aspx , but the idea of it is still blur. Please,someone can explain to me how this actually works and how can i create a master key?
Please i really need to learn this. Thank You :)
Here's the simpliest explaination to my problem, when i accidentally deleted my database and i don't have any backup, of course my system wont work right? but what i want is i need to login or have an access to my system even without my database and of course there will be no data. How could i do that?PLease i really need help
I don't quite understand. If your database is deleted and you don't have a backup then your out of luck. There is no magic software solution that will get it back. Well, there is if you want to discuss data recovery tools etc. but I don't believe that is what you are referring too here.
The link that you posted demonstrates how to encrypt your data. This is useful for protecting sensitive data from prying eyes (be it over a network connection or if somebody actually copied your database). It will not protect you from having your database deleted or corrupted.
So my advice. Backup, Backup, Backup.
@djjeavons. thank you for your reply, yeah i need to back my database so i created a back up and restore form. But it's just my idea that what if i didnt back up or accidentally delete my backup/corrupted, the possibility of it is, i can not log in in my system right?, but what i want is i want to log in in my system without a database.I Know im sound like nonsense, but im just playing with my idea, :)
here's what i found
in my system[Restaurant System] - properties -settings
in settings[name: pass, type:string, scope:user, value:masterkey(it's my password)]
public class frmlogin
Dim setting As New My.MySettings()
Private Sub btnlogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlogin.Click Try Dim sql = "SELECT * FROM tblUsers WHERE usertype='" & TextBox1.Text & "' AND id = '" & TextBox2.Text & "' AND activation ='Activate'" Dim cmd = New OleDbCommand(sql, con) Dim dr As OleDbDataReader = cmd.ExecuteReader If dr.Read = False Then MessageBox.Show("Incorrect Username/Password. Login Denied ", " Error! ", MessageBoxButtons.OK, MessageBoxIcon.Error) ErrorCount = ErrorCount + 1 'add this here TextBox2.Text = "" Else frmmain.Show() Me.Close() End If End Try Catch ex As Exception MessageBox.Show("No Connection is Available") If TextBox2.Text = setting.pass Then frmmain.Show() Me.Hide() End If End Try End Sub
it still messy but im working on it.
Ok, I kind of see where you are coming from. I assume that if your database was deleted you would still want to login to your system and possibly recreate the database file (obviously without all of the data as that is gone).
If that is the case, I would approach it a little differently to what you have provided above.
First, instead of connecting to the database and relying on an exception to tell you if the database is there or not, use the File.Exists method as this is an Access database.
Secondly, you could add a bare bones Access database (structure and necessary data) to a resource in your project and if the database does not exist, extract this database out of the resource to disk so that you can then start using a new blank database. See Creating Resource Files for Desktop Apps.
@djjeavons, yeah, that's what i want to do, thank you, i will try to study the link. So i need to create a txt file first , actually what's in my mind right now is, i will use try catch ,like for example
I really don't recommend using Exception handling for this type of logic. A simple If File.Exists(path to database file) would suffice.
oh, i see, i'll work on it :) even though i don't know how to use that :),but still i'll try