c#做了个报表,但在进入crystalReportViewer界面时按“确定”,没有出格式报表。而是弹出“数据库登陆”提示框。要求输入用户ID和密码。但输入了SQl2005 的sa和密码后提示不能进入。不知为何。

解决方案 »

  1.   


     private void btnFindOk_Click(object sender, EventArgs e)
            {
                //为报表设定查询语句
                string P_selectionFormula = "{tb_User.Name} like "
                    + "'*" + this.txtName.Text + "*' and {tb_User.Sex}='" + this.cbxSex.Items[this.cbxSex.SelectedIndex].ToString() + "'";
                P_selectionFormula += " and {tb_User.Post}='" + this.cbxPost.SelectedValue.ToString();
                P_selectionFormula += "' and {tb_User.Department}='" + this.cbxDepName.SelectedValue.ToString() + "'";            this.crystalReportViewer1.ReportSource = G_OperationForm.CrystalReports("CrystalEmployeeReport.rpt",P_selectionFormula); ;  //显示满足条件的报表信息
            }