Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm working on a network and I've installed the database.
On the computer I used to create the program I can log in normally, without the password request. But on other computers, when you open the report, it prompts you to log in. I do not know why.
Aogra, only my computer has sql server installed. The others get the IP of the database server. The program works well, can get all data from the database. The problem is when you open the CrystalReport report.


What I have tried:

C#
private void btnGerarInvoice_Click(object sender, EventArgs e)
        {
            int codeSell;
            if (int.TryParse(txtCodInvoice.Text, out codeSell))
            {
                ReportDocument cryRpt = new ReportDocument();
                cryRpt.Load(@"reportVendas.rpt");
                cryRpt.SetDatabaseLogon("yangue_user", "test1@Yangue");
                cryRpt.DataSourceConnections[0].IntegratedSecurity = false;
                ParameterFieldDefinitions crParameterFieldDefinitions;
                ParameterFieldDefinition crParameterFieldDefinition;
                ParameterValues crParameterValues = new ParameterValues();
                ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
                crParameterDiscreteValue.Value = codeSell;
                crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
                crParameterFieldDefinition = crParameterFieldDefinitions["@IDVenda"];
                crParameterValues = crParameterFieldDefinition.CurrentValues;
                crParameterValues.Clear();
                crParameterValues.Add(crParameterDiscreteValue);
                crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
                crystalReportViewer1.ReportSource = cryRpt;
                crystalReportViewer1.Refresh();
            }
            else
            {
                MessageBox.Show("Please enter the numeric code of the invoice!");
                txtCodInvoice.Focus();
            }
        }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900