Logon failed. Details: crdb_adoplus : Object reference not set to an instance of an object. Error in File C:\Users\puy\AppData\Local\Temp\temp_30b1c203-656f-4baa-bcf0-1f3973082664 {7558C8AA-A85C-410E-993A-CA4CCADB14E6}.rpt: Unable to connect: incorrect log on parameters

Please help me:(

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Data.Common;
using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Common;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;

namespace SURVEY
{
public partial class ResultView: System.Web.UI.Page
{
    string sqlQuery;
    //public DataSet ds;
    //public DataTable dt;
    //public DataAdapter da;
        public string strConn = System.Configuration.ConfigurationManager.ConnectionStrings["dbSurvey"].ConnectionString;

    DataSet Ds;
    DataTable Dt;
    SurvResRpt report = new SurvResRpt();
    EmpAnsRpt report1 = new EmpAnsRpt();
    CRbyDepartment report2 = new CRbyDepartment();

    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
        {
            displayresult();

        }           

    }


    private void displayresult()
    {

        string btn = Convert.ToString(Session["sender"]);

        if (btn.Equals("1"))
        {

            DateTime pdateFrom = Convert.ToDateTime(Session["dFrom"]);
            DateTime pdateTo = Convert.ToDateTime(Session["dUntil"]);
            sqlQuery = "SELECT * from survAns,quesTable where( sysdate BETWEEN '" + pdateFrom + "' AND '" + pdateTo + "')";
            SqlConnection sqlConn = new System.Data.SqlClient.SqlConnection(strConn);
            SqlDataAdapter Da = new System.Data.SqlClient.SqlDataAdapter(sqlQuery, sqlConn);
            sqlConn.Open();
            Ds = new DataSet();
            Da.Fill(Ds, "survAns");
            Dt = Ds.Tables["survAns"];

            if (Dt.Rows.Count > 0)
            {

                crviewer.ReportSource = null;
                report.SetDataSource(Dt);
                report.SetParameterValue("dtFrom", pdateFrom);
                report.SetParameterValue("dtTo", pdateTo);
                crviewer.ReportSource = report;

            }
        }
        else if (btn.Equals("2"))
        {
            int employeeID = Convert.ToInt32(Session["empID"]);


            if (Dt.Rows.Count > 0)
            {
                crviewer.ReportSource = null;
                report1.SetDataSource(Dt);
                report1.SetParameterValue("emp_IDno", employeeID);
                crviewer.ReportSource = report1;

            }


        }
        else if (btn.Equals("3"))
        {
            string Dept = Convert.ToString(Session["ddldept"]);


                if (Dt.Rows.Count > 0)
                {
                    crviewer.ReportSource = null;
                    report2.SetDataSource(Dt);
                    report2.SetParameterValue("dept", Dept.ToString());
                    crviewer.ReportSource = report2;

                }
            }
        }
    }
}

Edited 4 Years Ago by crystalpaper

This article has been dead for over six months. Start a new discussion instead.