setting Access in C#

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John K

    #1

    setting Access in C#

    ok,
    I'm lost at how to try this.... any pointers on
    how to set the password of an access DB within C#?

    this is what I tried:

    string strDestDB2 = "NewMdb.mdb ";
    string strSourceConnec t2 = "Data Source=" + strDestDB;
    string strDestConnect2 = "Data Source=" + strDestDB2
    + ";Jet OLEDB:Password= "+SAPasswor d;
    jetEngine.Compa ctDatabase(strS ourceConnect2,
    strDestConnect2 );

    John

  • Miha Markic

    #2
    Re: setting Access in C#

    Hi John,

    Here you go
    @"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet
    OLEDB:Database Locking Mode=1;Jet OLEDB:Database Password=YOURPA SSWORD;Data
    Source=""DATABA SE"";Password=; Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk
    Transactions=1; Provider=""Micr osoft.Jet.OLEDB .4.0"";Jet OLEDB:System
    database=;Jet OLEDB:SFP=False ;Extended Properties=;Mod e=Share Deny None;Jet
    OLEDB:New Database Password=;Jet OLEDB:Create System Database=False; Jet
    OLEDB:Don't Copy Locale on Compact=False;J et OLEDB:Compact Without Replica
    Repair=False;Us er ID=Admin;Jet OLEDB:Encrypt Database=False"



    If you are using password set on database you should set OLEDB:Database
    Password (and not Password) connection string property.


    --
    Miha Markic - RightHand .NET consulting & software development
    miha at rthand com

    "John K" <anonymous@disc ussions.microso ft.com> wrote in message
    news:00b401c3b1 e2$c6b98c80$a10 1280a@phx.gbl.. .[color=blue]
    > ok,
    > I'm lost at how to try this.... any pointers on
    > how to set the password of an access DB within C#?
    >
    > this is what I tried:
    >
    > string strDestDB2 = "NewMdb.mdb ";
    > string strSourceConnec t2 = "Data Source=" + strDestDB;
    > string strDestConnect2 = "Data Source=" + strDestDB2
    > + ";Jet OLEDB:Password= "+SAPasswor d;
    > jetEngine.Compa ctDatabase(strS ourceConnect2,
    > strDestConnect2 );
    >
    > John
    >[/color]


    Comment

    • Paul Clement

      #3
      Re: setting Access in C#

      On Sun, 23 Nov 2003 08:56:45 -0800, "John K" <anonymous@disc ussions.microso ft.com> wrote:

      ¤ ok,
      ¤ I'm lost at how to try this.... any pointers on
      ¤ how to set the password of an access DB within C#?
      ¤
      ¤ this is what I tried:
      ¤
      ¤ string strDestDB2 = "NewMdb.mdb ";
      ¤ string strSourceConnec t2 = "Data Source=" + strDestDB;
      ¤ string strDestConnect2 = "Data Source=" + strDestDB2
      ¤ + ";Jet OLEDB:Password= "+SAPasswor d;
      ¤ jetEngine.Compa ctDatabase(strS ourceConnect2,
      ¤ strDestConnect2 );

      If you want to set or change the password for an Access database you can use DDL (with Jet 4.0). See
      the following example:




      Paul ~~~ pclement@amerit ech.net
      Microsoft MVP (Visual Basic)

      Comment

      Working...