CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Location
    India
    Posts
    44

    Angry Open an Password Protected Access-2000 Database (OLE DB)

    Hi,
    I have created reports for a password protected database using Crystal Reports-8 thru OLE DB Connection. Whenever calling the report from a VB Form(thru Crystal Report Active-x Control), it reports "Unable to logon to SQL Server".

    But if I try same thru ODBC Connection thru a DSN, it works perfect.

    Since, there is a need to change the name of the source database (during runtime, the report has to access data from different databases), I require the same thru an OLE DB Connection. OR there is any way to change the database name in an odbc dsn by modifying connection parameters?

    I remain.

    Thanks.

  2. #2
    Join Date
    Dec 2002
    Location
    Pakistan
    Posts
    11

    Re: Open an Password Protected Access-2000 Database (OLE DB)

    If u r tring to open Access database which has password. to change the database at runtime u can use the following code in vb.My report using Direct Database file connection not oledb or others.

    Report.Database.Tables.Item(1).Location = App.Path & "\" & dbName
    Report.Database.Tables(1).SetSessionInfo "", Chr(10) & txtPass

    if u have more then on table u can use loop.

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