Database Login for Crystal reports

Discussion in 'Microsoft VB .NET' started by Murali via DotNetMonster.com, Sep 24, 2005.

  1. Hi All
    I am new to .net, as i worked majorily on VB6.0 & Crystal reports,
    I have developed an Window application in VB.net/SQL Server2000 and using
    Crystal reports8.5, I have used the CRViewer in the form.
    Now my problem is when i try to open Crystal report thro VB.net, it will
    prompt for database login password, which i have already supplied in Crystal
    report and also thro the application.(I am using DSN based connection)
    Please help me to solve this problem....

    Sample Code.
    {
    on Button click...
    Dim rpt1 As New Form2 ' Here Form2 is the form with CrystalReportViewer,
    ReportSource in Viewer is set to RPT file...
    rpt1.Show()
    }
    Thanks in advance....
    I apoligise if this is the wrong forum to post this question.

    Regards,
    Murali

    --
    Murali
    VSM Software (P) Ltd.
    Bangalore
     
    Murali via DotNetMonster.com, Sep 24, 2005
    #1
    1. Advertisements

  2. Murali via DotNetMonster.com

    Phil G. Guest

    Hi,

    You state 'it will prompt for database login password, which i have already
    supplied in Crystal report'. Have you supplied this info. in the wizard for
    the db connection or have you hard-coded it? If you have hard-coded it can
    you provide an example.

    Rgds, Phil


    "Murali via DotNetMonster.com" <> wrote in message
    news:...
    > Hi All
    > I am new to .net, as i worked majorily on VB6.0 & Crystal reports,
    > I have developed an Window application in VB.net/SQL Server2000 and using
    > Crystal reports8.5, I have used the CRViewer in the form.
    > Now my problem is when i try to open Crystal report thro VB.net, it will
    > prompt for database login password, which i have already supplied in
    > Crystal
    > report and also thro the application.(I am using DSN based connection)
    > Please help me to solve this problem....
    >
    > Sample Code.
    > {
    > on Button click...
    > Dim rpt1 As New Form2 ' Here Form2 is the form with
    > CrystalReportViewer,
    > ReportSource in Viewer is set to RPT file...
    > rpt1.Show()
    > }
    > Thanks in advance....
    > I apoligise if this is the wrong forum to post this question.
    >
    > Regards,
    > Murali
    >
    > --
    > Murali
    > VSM Software (P) Ltd.
    > Bangalore
     
    Phil G., Sep 24, 2005
    #2
    1. Advertisements

  3. HI Phil!
    I had used DSN connection, during the design time i selected the required
    views & fields...And through VB.net i open the Report ( I have used CRViewer
    in a form and i open that form on click of a button from the main form.)

    Please help....

    Regards,
    Murali

    Phil G. wrote:
    >Hi,
    >
    >You state 'it will prompt for database login password, which i have already
    >supplied in Crystal report'. Have you supplied this info. in the wizard for
    >the db connection or have you hard-coded it? If you have hard-coded it can
    >you provide an example.
    >
    >Rgds, Phil
    >
    >> Hi All
    >> I am new to .net, as i worked majorily on VB6.0 & Crystal reports,

    >[quoted text clipped - 19 lines]
    >> Regards,
    >> Murali


    --
    Murali
    VSM Software (P) Ltd.
    Bangalore,India


    Message posted via DotNetMonster.com
    http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-vb-net/200509/1
     
    Murali via DotNetMonster.com, Sep 26, 2005
    #3
  4. Murali via DotNetMonster.com

    Phil G. Guest

    Hi Murali,

    Unfortunately I made this 'mistake'! :)

    Although you will probably see that the pop-up login info box always
    includes the login name, it still requires the password. This apparently is
    the correct operation, although personally I don't see the need for
    specifically coding the info. if it has already been entered through the
    IDE.

    However, what you need to do is use the TableLogonInfo Class of CR. Here's
    an example:-

    [Global Decs]

    Dim objRepDoc As New ReportDocument
    Dim crTable As Table
    Dim crLogInfo As CrystalDecisions.Shared.TableLogOnInfo

    [method call - maybe in load or cmdbutton]

    crTable = objRepDoc.Database.Tables(0)
    crLogInfo = crTable.LogOnInfo
    With crLogInfo.ConnectionInfo
    .UserID = "username"
    .Password = "password"
    End With
    crTable.ApplyLogOnInfo(crLogInfo)
    frmRep.CRViewer.ReportSource = objRepDoc
    frmRep.Show()

    Let me know if you have problems. Good luck. Phil

    "Murali via DotNetMonster.com" <u14242@uwe> wrote in message
    news:54ecef9ca0618@uwe...
    > HI Phil!
    > I had used DSN connection, during the design time i selected the required
    > views & fields...And through VB.net i open the Report ( I have used
    > CRViewer
    > in a form and i open that form on click of a button from the main form.)
    >
    > Please help....
    >
    > Regards,
    > Murali
    >
    > Phil G. wrote:
    >>Hi,
    >>
    >>You state 'it will prompt for database login password, which i have
    >>already
    >>supplied in Crystal report'. Have you supplied this info. in the wizard
    >>for
    >>the db connection or have you hard-coded it? If you have hard-coded it can
    >>you provide an example.
    >>
    >>Rgds, Phil
    >>
    >>> Hi All
    >>> I am new to .net, as i worked majorily on VB6.0 & Crystal reports,

    >>[quoted text clipped - 19 lines]
    >>> Regards,
    >>> Murali

    >
    > --
    > Murali
    > VSM Software (P) Ltd.
    > Bangalore,India
    >
    >
    > Message posted via DotNetMonster.com
    > http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-vb-net/200509/1
     
    Phil G., Sep 26, 2005
    #4
  5. Hi Phil !
    This code does not helped me.....
    I got similar code from the website, It works in my system and does not in my
    clients system...
    Both have VS2003 and .net Framework1.1, Crystal report 8.5...
    I found an alternative solution for this i have created a user with blank
    password in the SQL Server and this login i am using for opening the crystal
    reports..
    Anyway please suggest an alternative option....

    Regards,
    Murali


    Phil G. wrote:
    >Hi Murali,
    >
    >Unfortunately I made this 'mistake'! :)
    >
    >Although you will probably see that the pop-up login info box always
    >includes the login name, it still requires the password. This apparently is
    >the correct operation, although personally I don't see the need for
    >specifically coding the info. if it has already been entered through the
    >IDE.
    >
    >However, what you need to do is use the TableLogonInfo Class of CR. Here's
    >an example:-
    >
    >[Global Decs]
    >
    >Dim objRepDoc As New ReportDocument
    >Dim crTable As Table
    >Dim crLogInfo As CrystalDecisions.Shared.TableLogOnInfo
    >
    >[method call - maybe in load or cmdbutton]
    >
    >crTable = objRepDoc.Database.Tables(0)
    >crLogInfo = crTable.LogOnInfo
    > With crLogInfo.ConnectionInfo
    > .UserID = "username"
    > .Password = "password"
    > End With
    >crTable.ApplyLogOnInfo(crLogInfo)
    >frmRep.CRViewer.ReportSource = objRepDoc
    >frmRep.Show()
    >
    >Let me know if you have problems. Good luck. Phil
    >
    >> HI Phil!
    >> I had used DSN connection, during the design time i selected the required

    >[quoted text clipped - 23 lines]
    >>>> Regards,
    >>>> Murali


    --
    Murali
    VSM Software (P) Ltd.
    Bangalore,India


    Message posted via http://www.dotnetmonster.com
     
    Murali via DotNetMonster.com, Sep 27, 2005
    #5
  6. Murali via DotNetMonster.com

    Ayaz Ahmed Guest

    Hello,

    Use This code

    Dim crReportDocument
    crReportDocument = New TestReport

    crConnectionInfo.ServerName = databaseServer
    crConnectionInfo.DatabaseName = databaseName
    crConnectionInfo.UserID = databaseUser crConnectionInfo.Password =
    UserPassword

    crTables = crReportDocument.Database.Tables
    Dim i As Integer
    i = 1
    For Each crTable In crTables
    'crTable = crTables(i)
    crTableLogOnInfo = crTable.LogOnInfo
    crTableLogOnInfo.ConnectionInfo = crConnectionInfo
    crTable.ApplyLogOnInfo(crTableLogOnInfo)
    crTable.Location =
    crTable.Location.Substring(crTable.Location.LastIndexOf(".") + 1)
    Next
    CRViewer.ReportSource = crReportDocument

    Thanks,


    Regards,

    Ayaz Ahmed
    Project Manager
    Creative Chaos (Pvt.) Ltd.
    "Managing Your Digital Risk"
    http://www.csquareonline.com
    Mobile +92 300 2280950
    Office +92 21 455 2414
    Email:


    *** Sent via Developersdex http://www.developersdex.com ***
     
    Ayaz Ahmed, Sep 27, 2005
    #6
  7. Hi !
    I am using the same code, but it still displays the database login screen..
    I hav changed the report connetion to DSN to OLEDB type.
    But i the problem still persists...
    As i mentioned already, i found the temporary solution with blank password
    login name...
    Anyways plz let me know any other methods to avoid database login prompt..

    Thanks & Regards,
    Murali M


    Ayaz Ahmed wrote:
    >Hello,
    >
    >Use This code
    >
    >Dim crReportDocument
    >crReportDocument = New TestReport
    >
    >crConnectionInfo.ServerName = databaseServer
    >crConnectionInfo.DatabaseName = databaseName
    >crConnectionInfo.UserID = databaseUser crConnectionInfo.Password =
    >UserPassword
    >
    > crTables = crReportDocument.Database.Tables
    > Dim i As Integer
    > i = 1
    > For Each crTable In crTables
    > 'crTable = crTables(i)
    > crTableLogOnInfo = crTable.LogOnInfo
    > crTableLogOnInfo.ConnectionInfo = crConnectionInfo
    > crTable.ApplyLogOnInfo(crTableLogOnInfo)
    > crTable.Location =
    >crTable.Location.Substring(crTable.Location.LastIndexOf(".") + 1)
    > Next
    > CRViewer.ReportSource = crReportDocument
    >
    >Thanks,
    >
    >Regards,
    >
    >Ayaz Ahmed
    >Project Manager
    >Creative Chaos (Pvt.) Ltd.
    >"Managing Your Digital Risk"
    >http://www.csquareonline.com
    >Mobile +92 300 2280950
    >Office +92 21 455 2414
    >Email:
    >


    --
    Murali
    VSM Software (P) Ltd.
    Bangalore,India


    Message posted via DotNetMonster.com
    http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-vb-net/200509/1
     
    Murali via DotNetMonster.com, Sep 28, 2005
    #7
  8. Murali via DotNetMonster.com

    Ayaz Ahmed Guest

    Hello,

    Please go crystal report viewer proporties and go to the behaviour
    category "EnableDatabaseLoginPrompt" set to false

    Thanks,


    Regards,

    Ayaz Ahmed
    Project Manager
    Creative Chaos (Pvt.) Ltd.
    "Managing Your Digital Risk"
    http://www.csquareonline.com
    Mobile +92 300 2280950
    Office +92 21 455 2414
    Email:


    *** Sent via Developersdex http://www.developersdex.com ***
     
    Ayaz Ahmed, Sep 28, 2005
    #8
  9. Hi Ayaz Ahmed!
    Sorry i could'nt find that property in my VS.net 2003 for CrystalReport
    Viewer.

    Regards,
    Murali

    Ayaz Ahmed wrote:
    >Hello,
    >
    >Please go crystal report viewer proporties and go to the behaviour
    >category "EnableDatabaseLoginPrompt" set to false
    >
    >Thanks,
    >
    >Regards,
    >
    >Ayaz Ahmed
    >Project Manager
    >Creative Chaos (Pvt.) Ltd.
    >"Managing Your Digital Risk"
    >http://www.csquareonline.com
    >Mobile +92 300 2280950
    >Office +92 21 455 2414
    >Email:
    >



    --
    Message posted via DotNetMonster.com
    http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-vb-net/200509/1
     
    Murali via DotNetMonster.com, Sep 28, 2005
    #9
  10. Murali via DotNetMonster.com

    YAR-X Guest

    hi i have the same problem and i tryed to find the property in vs2003
    and it is not there

    help please:)
     
    YAR-X, Sep 28, 2005
    #10
  11. Try this Code,
    ITs working for me...

    DIm crreportdocument As New CrystalReport1
    crreportdocument.SetDatabaseLogon("murali", "sa")



    YAR-X wrote:
    >hi i have the same problem and i tryed to find the property in vs2003
    >and it is not there
    >
    >help please:)


    --
    Murali
    VSM Software (P) Ltd.
    Bangalore,India


    Message posted via DotNetMonster.com
    http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-vb-net/200510/1
     
    Murali via DotNetMonster.com, Oct 10, 2005
    #11
  12. Murali via DotNetMonster.com

    mike Guest

    thatd does'nt work either. any other suggestions from anybody?
    Murali via DotNetMonster.com wrote:
    > Try this Code,
    > ITs working for me...
    >
    > DIm crreportdocument As New CrystalReport1
    > crreportdocument.SetDatabaseLogon("murali", "sa")
    >
    >
    >
    > YAR-X wrote:
    > >hi i have the same problem and i tryed to find the property in vs2003
    > >and it is not there
    > >
    > >help please:)

    >
    > --
    > Murali
    > VSM Software (P) Ltd.
    > Bangalore,India
    >
    >
    > Message posted via DotNetMonster.com
    > http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-vb-net/200510/1
     
    mike, Oct 10, 2005
    #12
  13. Hi Mike..
    Otherwise, If previlages are available in MSSQL Server, then u can create a
    user with blank password and use that details for connection in Crystal
    reports..
    Try this...

    Regards,
    Murali


    mike wrote:
    >thatd does'nt work either. any other suggestions from anybody?
    >> Try this Code,
    >> ITs working for me...

    >[quoted text clipped - 11 lines]
    >> VSM Software (P) Ltd.
    >> Bangalore,India


    --
    Murali
    VSM Software (P) Ltd.
    Bangalore,India


    Message posted via DotNetMonster.com
    http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-vb-net/200510/1
     
    Murali via DotNetMonster.com, Oct 11, 2005
    #13
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TJoker .NET
    Replies:
    6
    Views:
    15,571
    TJoker .NET
    Aug 18, 2003
  2. jaYPee

    crystal reports 9 and crystal reports.net

    jaYPee, Sep 3, 2004, in forum: Microsoft VB .NET
    Replies:
    0
    Views:
    350
    jaYPee
    Sep 3, 2004
  3. Boyd  Ferris

    Re: crystal reports 9 and crystal reports.net

    Boyd Ferris, Sep 3, 2004, in forum: Microsoft VB .NET
    Replies:
    2
    Views:
    317
    thomas wenning
    Sep 3, 2004
  4. Boyd  Ferris

    Re: crystal reports 9 and crystal reports.net

    Boyd Ferris, Sep 3, 2004, in forum: Microsoft VB .NET
    Replies:
    0
    Views:
    305
    Boyd Ferris
    Sep 3, 2004
  5. Peri
    Replies:
    1
    Views:
    396
    Guest
    Jul 21, 2005
Loading...

Share This Page