suggestions in connecting to an access database?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jaz215
    New Member
    • Nov 2007
    • 55

    suggestions in connecting to an access database?

    Hi everyone,

    i'm using an access database and the way i access it is thru an odbc systemdsn. but this time i don't want to use an odbc since when i install the program to other computers i have to keep on setting up the odbc how do i overcome this? any suggestions on what should i use instead?
  • Muiz
    New Member
    • Nov 2007
    • 6

    #2
    Hi,

    May be you can try using ADODB recordset.
    [code=vb]
    Dim con As ADODB.Connectio n
    Dim rs As ADODB.Recordset

    Set rs = New ADODB.Recordset
    Set con = New ADODB.Connectio n
    con.ConnectionS tring = "provider=micro soft.jet.oledb. 4.0;data source=\\wangmo d2\Database\Col AMS.mdb;" & "Jet OLEDB:Database Password=compaq "
    con.Open
    rs.Open "SELECT Username From Login;", con, adOpenDynamic, adLockOptimisti c

    ...
    ....
    rs.close
    con.close
    [/code]
    try this and let me know if you face problems.
    Last edited by debasisdas; Nov 27 '07, 11:16 AM. Reason: Formatted using code tags.

    Comment

    • CyberSoftHari
      Recognized Expert Contributor
      • Sep 2007
      • 488

      #3
      This type of code, you have to create exe for each time when the database path changed.
      Write connection string in text file and read it from there. This will be easy.

      Comment

      • jaz215
        New Member
        • Nov 2007
        • 55

        #4
        Thanks a lot you two :D

        it really helped me... ;P

        Comment

        Working...