CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: secur db

  1. #1
    Join Date
    Jul 2001
    Posts
    14

    secur db

    I have done some program that is working with access. How can I be sure that noone can Open this access file in access and change it.


  2. #2
    Join Date
    Aug 2000
    Location
    KY
    Posts
    766

    Re: secur db

    Look at the Help file in Access for MDE, if you save the database as an MDE file only VB apps can access the file


  3. #3
    Join Date
    Jul 2001
    Posts
    14

    Re: secur db

    I have save it like MDE, buth I can open it and change data in access?


  4. #4
    Join Date
    Jun 2001
    Location
    Northeast Tennessee
    Posts
    15

    Re: secur db

    you need to set the password on the database. first you have to open it exclusively. to do this:

    1) close the datbase if you have it open & make sure no other apps are using the database file
    2) goto file and open, browse to your database file
    3) highlight the database file and drop-down the open button on the open dialog and choose open exclusively.

    now you can set the password under tools->security->set database password

    now whenever the database file is opened you should be prompted for a passwd.

    -obiwan


  5. #5
    Join Date
    Jul 2001
    Location
    MN, USA
    Posts
    4

    Re: access pword

    When you open the database in code, you will have to set the password in your connection string. This will vary depending on how you access your database, but with an ADODB ConnectionString, you need "PWD=myPass" within the string, excluding the quotes. This is probably true for most other connection types.. if not, I've got a 1K page book on databases, so I can find out for you. dmbyer@i-techservices.com

    =====
    Dan

  6. #6
    Join Date
    Jul 2001
    Posts
    14

    Re: access pword

    I am using this code to open access, where shuld I type pwd.

    Adodc1.ConnectionString = "provider=microsoft.jet.oledb.4.0;" & "persist security info=false;" & "data source=c:\caset.mdb"

    Adodc1.RecordSource = "select*from 21Temp"


  7. #7
    Join Date
    Jul 2001
    Location
    MN, USA
    Posts
    4

    Re: access pword

    Subject: Re: access pword

    You'll have to register the database with the system. To do this, go to Settings>Control Panel then open up "ODBC Data Sources." If you don't have that control panel, look for an icon that has a big yellow "32" on it. If you still can't find it, chances are you don't have the control panel, which means you won't be able to use ODBC anyway. Taking into account that you do have it, click "Add..." once in the panel. Select "Microsoft Access Driver" then type in "caset" for the data source (excluding the quotes). Type anything you want for the description.. it doesn't matter. Now, under "Database" click "Select..." and find your caset.mdb database. Click ok. Voila, you now have an ODBC accessible database.
    I'm not entirely clear on all the other stuff you had in there, but I can tell you now that it isn't required. But you can have it in there for safe measure, in any case. Just seperate your statements within the string with the semicolon, and you're fine. There's no need to concatenate the strings. Here's the entire thing in code.


    Dim var1 as new ADODB.Connection
    Dim var2 as new ADODB.Recordset
    Dim var3

    var1.ConnectionString = "DSN=caset;PWD=yourPWD"
    var1.Open
    var2.Open "select from * yourTable", var1, adOpenStatic, adLockOptimistic

    'your code




    I hope that helps.. ask again if it doesn't, or you have further problems.

    =====
    Dan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured