Results 1 to 3 of 3

Thread: Change database source via code

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Posts
    3

    Change database source via code

    dear all,

    i have a problem with my vb application,i have 2 similar database but i use one application.
    so can i change the database source on crystal report by using vb code?
    i use SQL server database and use Dsn for the connection string..
    example:

    i log on to my application using database A and i open my report using that database.
    but when i log in again using database B and i open my report,it's still use database A.anyone can help me?
    thanks alot

    NB: sorry my english is very bad.

    best regards

    martell
    Last edited by martell; Apr 13th, 2007 at 02:27 AM. Reason: change

  2. #2
    Fanatic Member Dnereb's Avatar
    Join Date
    Aug 2005
    Location
    Netherlands
    Posts
    863

    Re: Change database source via code

    Changing the connection (close and open with a new connection string) to the apropriate DB should be enough (if they are truly similar in structure)

    If you're using a ADODC you can change it's connection as well by
    closing it and reopening with the other connection string.

    You should focus on the connection used by your report.
    why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
    for every question you ask provide an answer on another thread.

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Posts
    3

    Re: Change database source via code

    do u knoe how to change the database via code in the report?

    use this (report.Database.SetDataSource) ????
    thanks

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