?
Solved

Web Report keeps asking for username and password

Posted on 2011-10-13
12
Medium Priority
?
455 Views
Last Modified: 2012-05-12
I have a report that is from 1 database, that has 4 tables.  The login is the same for all.  I run this report on my local and it works fine, when I run on the production web server, it comes back and this what it looks like
 servername 10.10.10.44,8433)
database name:
User name: sa
Password: ***********

I've been working for over a day now and cant figure it out.  I've attached the code.  Again it works on my developement machine no problem

Protected Function PrintMakeReady() As Boolean
        Dim rd As New ReportDocument
        Dim rptDS As New DataSet
        Dim rptDS2 As New DataSet
        Dim myCmd As New SqlCommand
        Dim da As New SqlDataAdapter
       

        Dim myfilelocation As String = Server.MapPath("../Reports/MakeReadyReportWeb.rpt")
        'Try

        rd.Load(myfilelocation)
        rd.SetParameterValue(0, mWO_Number)
        rd.SetDatabaseLogon("sa", "sh4207", "10.10.10.44,8433", "AptGalleryInspections")

        Dim mSelection As String = ""
        Select Case mSubtype
            Case Is = "1"
                mSelection = "{MakeReadyMaster.WO_Number}={?WorkOrderNo} and ({MakeReadyDetails.PreInspect})=true "
            Case Is = "2"
                mSelection = "{MakeReadyMaster.WO_Number}={?WorkOrderNo} and ({MakeReadyDetails.Condition}<>'Satisfactory' and {MakeReadyDetails.Condition}<>'N/A' and {MakeReadyDetails.Condition}<>'Incomplete')"
        End Select
        rd.RecordSelectionFormula = mSelection
        Dim logon As New TableLogOnInfo
        Dim tbl As Table
        For Each tbl In rd.Database.Tables
            logon = tbl.LogOnInfo
            logon.ConnectionInfo.ServerName = "10.10.10.44,8433"
            logon.ConnectionInfo.DatabaseName = "AptGalleryInspections"
            logon.ConnectionInfo.UserID = "sa"
            logon.ConnectionInfo.Password = "sh4207"
            tbl.ApplyLogOnInfo(logon)
        Next

        CR1.ReportSource = rd

Open in new window

0
Comment
Question by:mgmhicks
  • 6
  • 4
  • 2
12 Comments
 
LVL 41

Expert Comment

by:Kyle Abrahams
ID: 36965144
You need to loop through the tables and assign the login info
http://forums.asp.net/t/1206308.aspx/1

FYI, you should mask the password in your code as well.



0
 
LVL 41

Expert Comment

by:Kyle Abrahams
ID: 36965157
0
 

Author Comment

by:mgmhicks
ID: 36965684
ged325 when you look at my code,  I think I am already looping through the tables.   I will check out the connection.type idea.

thanks
0
Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

 
LVL 8

Expert Comment

by:Crashman
ID: 36965774
Imports CrystalDecisions.Shared

     For Each connection As IConnectionInfo In Rpt.DataSourceConnections
            connection.SetConnection(server, base, user, pass)
     Next
0
 

Author Comment

by:mgmhicks
ID: 36968258
Crashman, when I do this do I get rid of setting connection info for all the tables? Thanks for helping
0
 
LVL 8

Expert Comment

by:Crashman
ID: 36969025
All the tables?, you maybe wish say connections, and if you take a look, you will see this code is for each connection , this code change all the CONNECTIONS,
I had the same problem some months ago, and as you, I had test the same code exactly and dont work, and with this, is solved
0
 

Author Comment

by:mgmhicks
ID: 36969239
Crashman, tried that works on local developement, but not on web server?  When it asks for username and info the database portion is blank, but it will only let you change the username or password.  What could be different?  I also have a couple of other reports that were already on the site, use same technique and they still run fine.  Totally frustrated!
0
 
LVL 8

Expert Comment

by:Crashman
ID: 36969266
this are not completely safe spaces, you tried to trim
0
 

Author Comment

by:mgmhicks
ID: 36969292
Not sure where arent safe spaces?.  I did attach what its asking me and a copy of current code.

Dim rd As New ReportDocument
        Dim rptDS As New DataSet
        Dim rptDS2 As New DataSet
        Dim myCmd As New SqlCommand
        Dim da As New SqlDataAdapter
       

        Dim myfilelocation As String = Server.MapPath("../Reports/MakeReadyReportWeb.rpt")
        'Try

        rd.Load(myfilelocation)
        rd.SetParameterValue(0, mWO_Number)
        rd.SetDatabaseLogon("sa", "sh4207", "10.10.10.44,8433", "AptGalleryInspections")

        Dim mSelection As String = ""
        Select Case mSubtype
            Case Is = "1"
                mSelection = "{MakeReadyMaster.WO_Number}={?WorkOrderNo} and ({MakeReadyDetails.PreInspect})=true "
            Case Is = "2"
                mSelection = "{MakeReadyMaster.WO_Number}={?WorkOrderNo} and ({MakeReadyDetails.Condition}<>'Satisfactory' and {MakeReadyDetails.Condition}<>'N/A' and {MakeReadyDetails.Condition}<>'Incomplete')"
        End Select

        rd.RecordSelectionFormula = mSelection
        Dim logon As New TableLogOnInfo
        Dim tbl As Table
        For Each tbl In rd.Database.Tables
            logon = tbl.LogOnInfo
            logon.ConnectionInfo.ServerName = "xx.xx.xx.x,xxxx"
            logon.ConnectionInfo.DatabaseName = "AptGalleryInspections"
            logon.ConnectionInfo.UserID = "sa"
            logon.ConnectionInfo.Password = "sh4207"
            logon.ConnectionInfo.Type = ConnectionInfoType.SQL
            tbl.ApplyLogOnInfo(logon)
        Next

        For Each connection As IConnectionInfo In rd.DataSourceConnections
            connection.SetConnection("10.10.10.44,8433", "AptGalleryInspections", "sa", "sh4207")
        Next

        CR1.ReportSource = rd


Crystal-Login-Page.gif
0
 
LVL 8

Expert Comment

by:Crashman
ID: 36969416
You are using Stored Procedures for the report?

try this

Dim rd As New ReportDocument
        Dim rptDS As New DataSet
        Dim rptDS2 As New DataSet
        Dim myCmd As New SqlCommand
        Dim da As New SqlDataAdapter
       

        Dim myfilelocation As String = Server.MapPath("../Reports/MakeReadyReportWeb.rpt")
        'Try

        rd.Load(myfilelocation)
        rd.SetParameterValue(0, mWO_Number)

        Dim mSelection As String = ""
        Select Case mSubtype
            Case Is = "1"
                mSelection = "{MakeReadyMaster.WO_Number}={?WorkOrderNo} and ({MakeReadyDetails.PreInspect})=true "
            Case Is = "2"
                mSelection = "{MakeReadyMaster.WO_Number}={?WorkOrderNo} and ({MakeReadyDetails.Condition}<>'Satisfactory' and {MakeReadyDetails.Condition}<>'N/A' and {MakeReadyDetails.Condition}<>'Incomplete')"
        End Select

        rd.RecordSelectionFormula = mSelection
        For Each connection As IConnectionInfo In rd.DataSourceConnections
            connection.SetConnection("10.10.10.44,8433", "AptGalleryInspections", "sa", "sh4207")
        Next
        CR1.ReportSource = rd
       
0
 

Accepted Solution

by:
mgmhicks earned 0 total points
ID: 36969940
I finally solved the problem.  The code was fine.  I had created the reports using sql native client as soon as I made it oledb the problems went away.  Dont know exactly why sql natvie doesnt work on web machine, but I have things running.  
0
 

Author Closing Comment

by:mgmhicks
ID: 36991277
Turned out to be the driver the reports were created with.  However I think this solution will be helpful to others as well.
0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question