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.
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(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)