Results 1 to 11 of 11

Thread: ado connection prob.

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2004
    Location
    kota,rajasthan(India)
    Posts
    53

    Question ado connection prob.

    hi
    when i m connect a database using ado code.
    i m getting an error message "not a valid password"
    code is
    dim cnnstr as string
    cnnstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path + "\safal_data.mdb;Jet OLEDBatabase Password=MyDbPassword;"
    plz solve my prob immidietly.
    Last edited by sonofgupta; Apr 4th, 2005 at 06:01 AM. Reason: typing mistake
    Piyush Gupta

  2. #2
    Lively Member
    Join Date
    Aug 2001
    Posts
    103

    Re: ado connection prob.

    VB Code:
    1. cnnstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path + "\safal_data.mdb;Jet OLEDBatabase Password=" & MyDbPassword & ";"

  3. #3
    Addicted Member Luke K's Avatar
    Join Date
    Jun 2004
    Location
    Perth, Australia
    Posts
    183

    Re: ado connection prob.

    If your password is stored in the MyDbPassword variable, then yes, newbiekea post is correct as it is treating it as a string literal, therefore, no matter what you set MyDbPassword to your connection object will be trying to connect with the password "MyDbPassword". If this is the case, follow newbiekea's post.

    Also, try and be a little nicer with your posts, we are a friendly community here
    Artificial Intelligence At War! - The best game of its genre
    Program your own robot and watch it fight in 3d!
    Droidarena 3

    If I have been useful, please Rate My Post

    Support FireFox -
    Microsoft Visual Studio .NET Professional 2003
    Microsoft Visual Studio 6, Enterprise Edition
    Microsoft Windows XP Professional, Service Pack 2

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: ado connection prob.

    Also, if you dont have a db password set yet you will get an error. Set the pwd first then do
    as previously posted.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Member
    Join Date
    Aug 2004
    Location
    kota,rajasthan(India)
    Posts
    53

    Angry Re: ado connection prob.

    Quote Originally Posted by newbiekea
    VB Code:
    1. cnnstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path + "\safal_data.mdb;Jet OLEDBatabase Password=" & MyDbPassword & ";"
    i had set password into database but when i apply ur code then a message is appear that "could not found ISAM"
    plz suggest me what i do?
    Piyush Gupta

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: ado connection prob.

    What version of Access are you running?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Member
    Join Date
    Aug 2004
    Location
    kota,rajasthan(India)
    Posts
    53

    Thumbs down Re: ado connection prob.

    Quote Originally Posted by RobDog888
    What version of Access are you running?
    i m using access 2002 version.
    Piyush Gupta

  8. #8
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: ado connection prob.

    I was going to suggest one from http://www.connectionstrings.com/
    but, found one that I use:

    VB Code:
    1. Dim cn As New ADODB.Connection 'connection
    2.      Dim rs As New ADODB.Recordset 'recordset
    3.       cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "MyData.mdb;Persist Security Info=False"
    4.       rs.Open "Delete TempTable .* from TempTable ", cn, adOpenKeyset, adLockOptimistic, adCmdText
    Last edited by dglienna; Apr 8th, 2005 at 04:47 AM.

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: ado connection prob.

    This should be the string you need for passwords.
    VB Code:
    1. cnnstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path + "\safal_data.mdb;User Id=admin;Password=" & MyDbPassword & ";"
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  10. #10

    Thread Starter
    Member
    Join Date
    Aug 2004
    Location
    kota,rajasthan(India)
    Posts
    53

    Question Re: ado connection prob.

    Quote Originally Posted by RobDog888
    This should be the string you need for passwords.
    VB Code:
    1. cnnstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path + "\safal_data.mdb;User Id=admin;Password=" & MyDbPassword & ";"
    ok,
    but where i can declare variable "mydbpassword"
    if my password is "num1234"
    Piyush Gupta

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: ado connection prob.

    Depends on how you want it to work.

    If your ok with hardcoding it into your app then you dont even need to use the variable, just code it where the var is.

    If you want to be able to change it without re-compiling then you can either store it in a file or the registry,
    encrypted or not. Its up to you.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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