Error after i set MS access a password

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • calvinkwoo3000
    New Member
    • Apr 2008
    • 4

    Error after i set MS access a password

    My window application run property before i set a password at mdb file.
    Below is my connection string that before and after set password

    conn = new OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0;Data Source=|DataDir ectory|\\mms.md b;");

    conn = new OleDbConnection ("Provider=Micr osoft.Jet.OLEDB .4.0;Data Source=|DataDir ectory|\\mms.md b;Jet OLEDB:Database Password=passwo rd;");

    Below is my pageload, and i found that error occure when run until this coding

    this.userTableA dapter.Fill(thi s.mmsDataSet.us er);

    Can anyone help me or told me what should i do?

    thanks.

    private void privateProperty Form_Load(objec t sender, EventArgs e)
    {
    //Get the proccessor serial num for this machine.
    SelectQuery query = new SelectQuery("Wi n32_BaseBoard") ;
    ManagementObjec tSearcher searcher = new ManagementObjec tSearcher(query );
    ManagementObjec tCollection coll = searcher.Get();

    String machineID = "";
    foreach (ManagementObje ct obj in coll)
    machineID = machineID + obj.Properties["SerialNumb er"].Value.ToString ();

    ArrayList user = dba.getData("co unter", "license", "id", "1");


    if (user.Count == 0)
    {
    MessageBox.Show ("Error: Database corrupted.");
    this.Close();
    }
    else
    {

    //Not activated
    if (user[0].ToString().Equ als("0"))
    {
    MessageBox.Show ("This software had not been activated. Please run activation.exe to activate.");
    this.Close();
    }
    else
    {

    try
    {

    user = dba.getData("ex piryDate", "license", "id", "1");
    string update = webservice.Upda teExpiryDate(db a.getMachineCod e());

    int diff = compareDate(Dat eTime.Now, user[0].ToString());
    if (diff > 1)
    {
    // ensure that the machine code match
    if (machineID != dba.getMachineC ode())
    {
    MessageBox.Show ("Error: Machine code mismatch.");
    this.Close();
    }
    for (int j = 1; j < tabControl.TabC ount-1; j++)
    {
    tabControl.TabP ages[j].Enabled = false;
    webBrowser2.Vis ible = false;
    }

    string services = webservice.Gets ervices(dba.get MachineCode());

    //MessageBox.Show (services);
    char[] sep = { ',' };
    Array a = services.Split( sep);

    for (int i = 0; i < a.Length; i++)
    {
    int j = Convert.ToInt32 (a.GetValue(i)) ;
    tabControl.TabP ages[j].Enabled = true;
    if (j==19)
    {
    webBrowser2.Vis ible = true;
    }

    }

    user = dba.getData("us er", "license", "id", "1");
    txt_username.Te xt = user[0].ToString();
    lbl_welcome.Tex t = "Welcome : " + user[0].ToString();
    user = dba.getData("Co ntactNumber", "license", "id", "1");
    txt_contact.Tex t = user[0].ToString();
    user = dba.getData("Em ail", "license", "id", "1");
    txt_email.Text = user[0].ToString();
    dba.setLicenseT able("counter", "" + diff);
    MessageBox.Show ("You have " + diff + " days left.");
    }
    else
    {
    MessageBox.Show ("Your software had expired. Please reactivate.");
    this.Close();
    }
    }
    catch (Exception err)
    {
    MessageBox.Show ("Error: Database corrupted." + err);
    this.Close();
    }
    }
    }

    this.userTableA dapter.Fill(thi s.mmsDataSet.us er);

    }
Working...