How to change logon information in crystal reports at runtime

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • munish

    How to change logon information in crystal reports at runtime

    I am using pull model in crystal reports.For simplicity I
    m using only one table in SQL Server. I have tried
    following code to change my database:
    ConnectionInfo ci = new ConnectionInfo( );
    ci.ServerName = Changed_SERVER_ NAME;
    ci.DatabaseName = Changed_DATABAS E_NAME;
    ci.UserID = Changed_DATABAS E_USER_NAME;
    ci.Password = Changed_DATABAS E_PASSWORD;
    TableLogOnInfo li = new TableLogOnInfo( );
    li.ConnectionIn fo = ci;
    li.TableName = ChangedTableNam eButSameStructu re;
    MyRep.Database. Tables[i].ApplyLogOnInfo (li);
    crViewer.Report Source = MyRep;
    But when i view the report using crystal report viewer
    control it shows me records of that table to which it was
    connected to, when the report was designed.

    Can anyone provide me help on this issue? Or tell me any
    other way to change logon information, database and tables
    at run time(in pull model)?
    Thanx
    munish
  • David Straker

    #2
    Re: How to change logon information in crystal reports at runtime

    Hi Munish,

    You might want to look at the microsoft.publi c.vb.crystal newsgroup. This
    question has been answered many times there. Brian Bischof also has an
    online book that explains it really well at


    David Straker

    "munish" <munishmalhotra 77@hotmail.com> wrote in message
    news:070f01c378 55$acf5d090$a50 1280a@phx.gbl.. .[color=blue]
    > I am using pull model in crystal reports.For simplicity I
    > m using only one table in SQL Server. I have tried
    > following code to change my database:
    > ConnectionInfo ci = new ConnectionInfo( );
    > ci.ServerName = Changed_SERVER_ NAME;
    > ci.DatabaseName = Changed_DATABAS E_NAME;
    > ci.UserID = Changed_DATABAS E_USER_NAME;
    > ci.Password = Changed_DATABAS E_PASSWORD;
    > TableLogOnInfo li = new TableLogOnInfo( );
    > li.ConnectionIn fo = ci;
    > li.TableName = ChangedTableNam eButSameStructu re;
    > MyRep.Database. Tables[i].ApplyLogOnInfo (li);
    > crViewer.Report Source = MyRep;
    > But when i view the report using crystal report viewer
    > control it shows me records of that table to which it was
    > connected to, when the report was designed.
    >
    > Can anyone provide me help on this issue? Or tell me any
    > other way to change logon information, database and tables
    > at run time(in pull model)?
    > Thanx
    > munish[/color]


    Comment

    Working...