Avatar of Carla Romere
Carla Romere
Flag for United States of America asked on

Removing Connections from "My Connections"

I have recently installed Visual Studio 2010 Professional and am working on getting a Crystal Reports site deployed using several hundred of our existing reports. I have a system DSN set up on my development machine as well as on the IIS server called 'Ross_Data'. Somewhere, somehow, someone has created reports using the DSN on their machine in all caps 'ROSS_DATA'. In my VS website, under My Connections, I have Ross_Data and ROSS_DATA. How do I completely remove the incorrect one - ROSS_DATA? When I look at "My Connections" I see them both. I can right click and remove Ross_Data, but that's the one I want to keep. Right clicking the incorrect one doesn't give me the option to delete it and I can't find any way or anywhere to edit it. I have several reports that won't open in CrystalReportsViewer- I think because they keep trying to open using ROSS_DATA instead of Ross_Data.
Microsoft DevelopmentASP.NET

Avatar of undefined
Last Comment
Carla Romere

8/22/2022 - Mon
Mike McCracken

I don't know of a way to remove one.

Were the reports that don't open, developed on your machine or by someone else?
Can you open the reports in Crystal and change the data source?

mlmcc
Carla Romere

ASKER
I can open them in CR in VS2010 and change the datasource, but as soon as I try to run it again, it automatically is picking the incorrect one. Occasionally it's even adding another one, i.e. Ross_Data_1. This is very bizarre. I'm still digging...
Mike McCracken

I haven't seen that problem.

mlmcc
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Carla Romere

ASKER
Leave it to me! I've got several reports that I'm using to get my coding correct before I start creating all the aspx pages for these reports. Every single report that we have on that server uses the same exact DSN - Ross_Data. I've gotten 2-3 different aspx pages created based on existing reports that have no subreports. Some work and some don't. I'm opening the reports themselves in CR2010/VS and saving them in the new format, but it's just not working on all of them. Literally I've copied the code from a working aspx page and pasted it on another and ONLY changed the name of the crystal report and it doesn't always work. I've got another one that actually has a filter set on the aspx page and it works perfectly fine and refreshes anytime the selection changes. I've been looking for a good book to get on VS2010 and/or Crystal Reports 2010 and/or C#. Do you have any suggestions?
Carla Romere

ASKER
For instance, this report takes the value selected in a DropDownList and pulls up the report only for that particular warehouse. This code works.

    private void ConfigureCrystalReports()
    {
        if (!IsPostBack)
        {
            crystalReportViewer.Visible = false;
        }

        string reportPath = ("~/customreports/CURRINV_GL_NOLOT_PROD.rpt");

        ConnectionInfo connectionInfo = new ConnectionInfo();
        connectionInfo.ServerName = "Ross_Data";
        connectionInfo.DatabaseName = "fin_prod";
        connectionInfo.UserID = "xxx";
        connectionInfo.Password = "xxx";
        crystalReportViewer.ReportSource = reportPath;

        SetDBLogonForReport(connectionInfo);

    }

    protected void ddlWarehouse_SelectedIndexChanged(object sender, EventArgs e)
    {
        string warehouse = ddlWarehouse.SelectedValue;
        string selectFormula = "{VW_CURRENT_INVENTORY_GL.WH}=" + "'" + warehouse + "'";
        crystalReportViewer.SelectionFormula = selectFormula;
        crystalReportViewer.Visible = true;
        crystalReportViewer.DataBind();
    }


        private void Page_Init(object sender, EventArgs e)
    {
        ConfigureCrystalReports();
    }

    private void SetDBLogonForReport(ConnectionInfo connectionInfo)
    {
        TableLogOnInfos tableLogOnInfos = crystalReportViewer.LogOnInfo;
        foreach (TableLogOnInfo tableLogOnInfo in tableLogOnInfos)
        {
            tableLogOnInfo.ConnectionInfo = connectionInfo;
        }
    }

Open in new window


The report refreshes correctly anytime you change the value in the DropDownList. So, I copied the code into a new aspx page for another report that gets filtered by the value entered into a textbox. This code does not work - stops at the screen asking for the server/user/password.

    private void ConfigureCrystalReports()
    {
        if (!IsPostBack)
        {
            crystalReportViewer.Visible = false;
        }

        string reportPath = ("~/customreports/BillOfLading2.rpt");

        ConnectionInfo connectionInfo = new ConnectionInfo();
        connectionInfo.ServerName = "Ross_Data";
        connectionInfo.DatabaseName = "fin_prod";
        connectionInfo.UserID = "xxx";
        connectionInfo.Password = "xxx";
        crystalReportViewer.ReportSource = reportPath;

        SetDBLogonForReport(connectionInfo);
    }

    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string bol = txtbol.Text;
        string selectFormula = "{VW_BOL_DESPATCH_HEADER.DESPATCH_NOTE_TEXT}=" + "'" + bol + "'";
        crystalReportViewer.SelectionFormula = selectFormula;
        crystalReportViewer.DataBind();
        crystalReportViewer.Visible = true;
    }

    private void Page_Init(object sender, EventArgs e)
    {
        ConfigureCrystalReports();
    }

    private void SetDBLogonForReport(ConnectionInfo connectionInfo)
    {
        TableLogOnInfos tableLogOnInfos = crystalReportViewer.LogOnInfo;
        foreach (TableLogOnInfo tableLogOnInfo in tableLogOnInfos)
        {
            tableLogOnInfo.ConnectionInfo = connectionInfo;
        }
    }

Open in new window


And the *really* weird thing is the first set of code, the one that works, actually has a subreport at the end of the report and it loads just fine and I don't even have the logon information set up for subreports yet (at least that works anyway).

I've opened both reports in CR2010 and saved them.
ASKER CERTIFIED SOLUTION
Carla Romere

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Carla Romere

ASKER
This was the only way I could resolve the connection problem.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.