CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Join Date
    Oct 2008
    Posts
    42

    not able to get report , asking login credentials

    i hve made a application in vs2005(frame work 2.0 which has crystal report
    in my system i have VS2005 software
    crytsal report whetver i needed i hve done it a design time ie added the fields needed during design time

    i had placed all the reports in folder knw as reports & had given the path accordingly
    when i first executed the app;lication & tried to view the report i got a msg something like " reports cann not be displayed , & needs to be in the bin folder of the application"
    so i pasted all the reports frm report folder in bin & now its working

    my application is working fine but when i try to view the reports it showed me a login dialog box which contained the servername, username & password
    though in config file i had specified clinet servername it took the server name of my system & asked for password



    code

    Private Sub CrystalReportViewer1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
    CrystalReportViewer1.Load

    Dim cryRpt As New ReportDocument
    Dim crtableLogoninfos As New TableLogOnInfos
    Dim crtableLogoninfo As New TableLogOnInfo
    Dim crConnectionInfo As New ConnectionInfo
    Dim CrTables As Tables
    Dim CrTable As Table


    With crConnectionInfo

    .ServerName = ConfigurationManager.AppSettings("ServerName") 'YOUR SERVER NAME"

    .DatabaseName = ConfigurationManager.AppSettings("MainData") 'YOUR DATABASE NAME"

    .UserID = ConfigurationManager.AppSettings("User_ID") 'YOUR DATABASE USERNAME"

    .Password = ConfigurationManager.AppSettings("Password") 'YOUR DATABASE PASSWORD"

    End With

    Dim ReportName As String = "cons.rpt"

    ReportName = Application.StartupPath & "\" & ReportName & ""

    Dim ReportForm As CrystalDecisions.CrystalReports.Engine.ReportDocum ent = New
    CrystalDecisions.CrystalReports.Engine.ReportDocum ent

    ReportForm.Load(ReportName)

    CrTables = ReportForm.Database.Tables

    For Each CrTable In CrTables

    crtableLogoninfo = CrTable.LogOnInfo

    crtableLogoninfo.ConnectionInfo = crConnectionInfo

    CrTable.ApplyLogOnInfo(crtableLogoninfo)
    Next

    CrystalReportViewer1.ReportSource = ReportForm

    CrystalReportViewer1.Refresh()

    End Sub

  2. #2
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: not able to get report , asking login credentials

    Dbl Check that you've entered the correct details in the correct Fields..
    Also note that often the Case of the fieldname has to be identical.. This is a sticking point sometimes, and its always best to DBL check the field name case.. (copy paste if need be)

    ...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  3. #3
    Join Date
    Oct 2008
    Posts
    42

    Re: not able to get report , asking login credentials

    wht do i double check
    i am into this from past 2.5 mths
    if u culd specify the details i culd look at that point specifically & hope i am able to come out
    let me knw wht points needs to be checked

    am i writing teh code wrong or is the place of writing teh code incorrect

  4. #4
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: not able to get report , asking login credentials

    Code:
    With crConnectionInfo
    .ServerName = ConfigurationManager.AppSettings("ServerName") 'YOUR SERVER NAME"
    .DatabaseName = ConfigurationManager.AppSettings("MainData") 'YOUR DATABASE NAME"
    .UserID = ConfigurationManager.AppSettings("User_ID") 'YOUR DATABASE USERNAME"
    .Password = ConfigurationManager.AppSettings("Password") 'YOUR DATABASE PASSWORD"
    End With
    Notice the RED highlights ... Have you DBL checked that the exsist in the right place and right CASE in your App.exe.config file.. Something like below....
    Code:
    <configuration>
      <appSettings>
        <add key="SiteSqlServer" value="Data Source=\SQLEXPRESS;Initial catalog=MyCat;Trusted_Connection=False;User ID=sa;Password=password;" />
        <add Name="ServerName" Value="\SQLEXPRESS" />
        <add Name="MainData" Value="MyCat" />
        <add Name="User_ID" Value="sa" />
        <add Name="Password" Value="password" />
      </appSettings>
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  5. #5
    Join Date
    Oct 2008
    Posts
    42

    Re: not able to get report , asking login credentials

    ya

    all that credentials are correct as the same is used in the application
    as i said my rest of the application works properly . i taken the credentials from app.config file for both the application as well as the reports

    is the way of teh code i have written correct? in which event shld it be specified??

    & one more thing wuld like to add is if i manually set this credentials at degin time for all the reports it works fine , i mean at run time it takes teh credentials set during the design time

    but in case i change the server name in app.config file only not n design of the report
    then during run time it doesnot take this new server crendetials
    it takes the old which was set during design phase only

    i hope i am clear

  6. #6
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: not able to get report , asking login credentials

    okay .. i think i know what's going on here....

    Check #1: Find the App.exe.config file in your solution explorer.. Under properties , look for Copy to output:

    Option #1.1: If 'Copy to output' is set to 'Do Not Copy'.. well your making changes but it's not coping it over to the Debug folder and using your new settings.

    Option #1.2: if 'Copy to output' is set to 'Copy Always'.. It's probable that you have been editing the wrong file and it's not coping the one you've been editing over to the debug folder..

    NOTE: I've personally had simular problems where VS will change this setting when some application options are changed...

    Look for the App.exe.config file in [Projectpath]/bin/debug folder and check if your new settings are in it...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  7. #7
    Join Date
    Oct 2008
    Posts
    42

    Re: not able to get report , asking login credentials

    i checked the app.config /properties
    in this initally it was donot copy

    i change it to copy always & executed the program
    there are 2 config file one is myproject.vshost.exe & othe r is myproject.exe
    i cheked the settings in both the files its set i mean it takes the new credentials

    but if u tell in detail abt teh config file in bin folder deatils as to wht it shld have in addition may be it culd be possible to trace teh problem if it exixts there

    after the changes made in properties it does take the new credentails & report gets displayed atlast

    T H A N KS a lot but there still persists a problem

    every time it displays the login in screen & ask for usernae & password
    after its entred then only its shows the report

    How can the report be seen directly?? with asking for login screen

    & i hope that when i compile & deploy the project at user end crystal report works fine
    Last edited by svibuk; April 22nd, 2011 at 01:29 AM.

  8. #8
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: not able to get report , asking login credentials

    That'.s also in the config file. You can set it to log in automatically
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  9. #9
    Join Date
    Oct 2008
    Posts
    42

    Re: not able to get report , asking login credentials

    this is my app.config file with teh settings

    <appSettings>

    <add key="ConnString" value="Data Source=SERVER;Initial Catalog=BILL;Integrated Security=True;Pooling=false;Enlist=false" />
    <add key="MainData" value=BILL" />
    <add key="Password" value="" />
    <add key="User_ID" value="" />
    <add key="Connect_Timeout" value="9000" />
    <add key="Pooling" value="false" />
    </appSettings>


    where do i set it for taking teh credentials & showing the report without getting login screen

    if i dont use Integrated Security=True then no records obtained


    one more issue that i am having on chnaging OS from 32 bit WIN XP to 64 bit WIN2008 . i installed the 64 bit crystalreport msi

    Microsoft Visual Studio
    ---------------------------
    The operation could not be completed. The specified module could not be found.
    ---------------------------
    OK
    ---------------------------

    i get teh above erro r msg when i am trying to open the crystal report rpt file in design mode
    i tried taking a new crysttal report but that too gives me same error msg
    Last edited by svibuk; April 23rd, 2011 at 02:12 AM.

  10. #10
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: not able to get report , asking login credentials

    Code:
    Integrated Security=True
    This causes your application to use the Windows user credentials to login to SQL, and not the supplied Credentials.

    change the line like this..
    Code:
    <add key="ConnString" value="Data Source=SERVER;Initial Catalog=BILL;Integrated Security=False;Pooling=false;Enlist=false;User id=*****;Password=****" />
    Also if your using a connection string, you dont need to supply all the other individual info..
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  11. #11
    Join Date
    Oct 2008
    Posts
    42

    Re: not able to get report , asking login credentials

    ya as i am currently using windows authentication for sql i use intergateg =true
    as i though that by making it windows authentication i wont get the login screen

    but even using windows authentication i get the logon screen where in i need to check the checkbox of integrated authentication
    i do use connection string in my application

    i am still not able to understand the concept behing getting logon screen when everything is provided in the code

    is there any solution for this ongoing issue

    & secondaly even i get that logon screen after a lot of time it seems that teh system is searching something & then provides the screen

    SQl or windows authentication i shld not get the LOgin screen

    i am not able t undertand that though things are correct , whts the wrong thing that happening
    Last edited by svibuk; April 23rd, 2011 at 04:47 AM.

  12. #12
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: not able to get report , asking login credentials

    Here's how I log into a SQL 2005 DB on a local server.

    Code:
        <add name="ConnectionString" connectionString="Integrated Security=SSPI;Pooling=false;Data Source=192.168.1.2\SQLEXPRESS;Initial Catalog=SIOK_Calendar"/>
    Also, for ACCESS

    Code:
        <!--
    		Use the following connection string to connect to a Jet (Microsoft Access) database:
    		<add name="ConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Password=;User ID=Admin;Data Source=SIOK_Calendar.mdb;Mode=Share Deny None;"/>
    		-->
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  13. #13
    Join Date
    Oct 2008
    Posts
    42

    Re: not able to get report , asking login credentials

    whats the difference in the code that i have and u have


    i have am preparing atest project & let me c teh code difference duw to which i am stuck up with loginscreen inspite of the things being right

    one more thing wuld like to ask is
    i have stored all the reports in reports folder
    but i have copied it to the bin folder as when i executed the application it gave a message that the reports need to be in the bin folder

    is it not possible to load & execute the reports from reports folder only
    Last edited by svibuk; April 25th, 2011 at 03:06 AM.

  14. #14
    Join Date
    Oct 2008
    Posts
    42

    Re: not able to get report , asking login credentials

    i just checked teh following things & the reults are

    In my sytem i made the necessary changes i the app.config file of my application having the source code , complied & executed . the application along with crystal report working fine without login screen

    (THANKS for the same)

    I made a setup project of the application & executed the exe with teh same app.config file which was set earlier
    the application & report working fie without login screen

    in the setup project(without source code) changed the servername , username & password
    when i open the exe i get the login screen with the newservername which i had put but asks for username & password(lOGIN SCREEN STILL DISPLAYED)
    after giving the username pasword its working fine


    so how can this LOGIN screen be supressed at the client end?

  15. #15
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: not able to get report , asking login credentials

    Set the Authentication. You probably have Windows Authentication turned on, which is why you don't get a prompt.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Page 1 of 2 12 LastLast

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