HI ME AGAIN=|

I'm basically new to connecting to database.

MY PROBLEM is that i do not know how to connected to database[ microsoft access]

eg. the password entered, is stored at microsoft access database. how do i connect the window application to database so that when i run the window application the password enter and saved is store into the database. and we can refer to database to see if they have type the wrong password.

I'm kinda stuck here that i can't proceed with my projext so i desperately need some advice=| thankss=))

Recommended Answers

All 2 Replies

I have posted a sample application using an SQL Connection, but you change the SqlConnection to OleDbConnection, SqlCommand to OleDbCommand, etc.
http://www.daniweb.com/code/snippet217409.html

For generating the access connection string:

public static string BuildAccessConnectionString(string Filename, string Username, string Password, string DatabasePassword)
    {
      return string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='{0}';User Id={1};Password={2};Jet OLEDB:Database Password={3};",
                                   Filename.Replace("'", "''"),
                                   Username,
                                   Password,
                                   DatabasePassword);
    }
    public static string BuildAccess2007ConnectionString(string Filename, string DatabasePassword)
    {
      return string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='{0}';Persist Security Info=False;Jet OLEDB:Database Password={1};",
                                 Filename.Replace("'", "''"),
                                 DatabasePassword);
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.