Question : c# form with microsoft access database and user level security

i have c# form and access database. i would like to have user level security on database.
is there a way to do this. I am unable even to get one user id and password to work.
i am trying user id john doe  password 123.
i have placed code below.
is this possible?
thank you
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
namespace Amount
{
    public partial class Form1 : Form
    {
        OleDbCommand cmd;
        OleDbConnection con;
        DataTable dt;
        OleDbDataAdapter da;
        public void DataConnection()
        {
            con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=./Amount.mdb");
            con.Open();
        }
        public Form1()
        {
            InitializeComponent();
        }

        private void btnAmount_Click(object sender, EventArgs e)
        {
            DataConnection();
            cmd = new OleDbCommand("Insert into tblAmount(SerialNumber,Amount)values(" + textBox1.Text + "," + textBox2.Text + ")", con);
            cmd.ExecuteNonQuery();
            textBox1.Text = "";
            textBox2.Text = "";
            MessageBox.Show("Data inserted successfully");
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}

Answer : c# form with microsoft access database and user level security

Hey Dave, I'm trying to understand your question. Do you want only certain users to be able to run the btnAmount_Click method to insert data into the database?

Random Solutions  
 
programming4us programming4us