vinayak.v 0 Light Poster

hi.. i'm using the database on live ..

i may do hosting on different system and ip is changed..

please help me the below code runs well when i remove the ispostback condition..

but when i keep that when page is loaded it works well but when i give print the database is

displayed which i've connected to the report using database experts...

please i want to overwrite the connection string when i press print button also ..


please can u add that code and make modification i dont know were to add that code.

the following is my code which is in page load

public partial class _Default : System.Web.UI.Page
{
string connections = ConfigurationManager.ConnectionStrings["SqlConn"].ConnectionString;
// private TableLogOnInfo LogInfo = new TableLogOnInfo();
ReportDocument myreport = new ReportDocument();
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack == false)
{
string myQuery = "select * from employee";

SqlConnection myConnection = new SqlConnection(connections);
SqlCommand myCommand = new SqlCommand(myQuery, myConnection);
myCommand.Connection.Open();


SqlDataAdapter da = new SqlDataAdapter(myCommand);
DataSet dt = new DataSet();
da.Fill(dt);
DataTable td = dt.Tables[0];
myreport.Load(MapPath("~/" + "emp.rpt"));
// myreport.Database.Tables[0].ApplyLogOnInfo(LogInfo);

myreport.Database.Tables[0].SetDataSource(td);
CrystalReportViewer1.ReportSource = myreport;
Logininfo();

//int count = Convert.ToInt32(dt.Tables[0].Rows.Count);
myConnection.Close();
}

}

hi.. i'm using the database on live ..

i may do hosting on different system and ip is changed..

please help me the below code runs well when i remove the ispostback condition..

but when i keep that when page is loaded it works well but when i give print the database is

displayed which i've connected to the report using database experts...

please i want to overwrite the connection string when i press print button also ..


please can u add that code and make modification i dont know were to add that code.

the following is my code which is in page load

 

public partial class _Default : System.Web.UI.Page
{
    string connections = ConfigurationManager.ConnectionStrings["SqlConn"].ConnectionString;
  // private TableLogOnInfo LogInfo = new TableLogOnInfo();
    ReportDocument myreport = new ReportDocument();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack == false)
        {
            string myQuery = "select * from employee";

            SqlConnection myConnection = new SqlConnection(connections);
            SqlCommand myCommand = new SqlCommand(myQuery, myConnection);
            myCommand.Connection.Open();


            SqlDataAdapter da = new SqlDataAdapter(myCommand);
            DataSet dt = new DataSet();
            da.Fill(dt);
            DataTable td = dt.Tables[0];
            myreport.Load(MapPath("~/" + "emp.rpt"));
            // myreport.Database.Tables[0].ApplyLogOnInfo(LogInfo);

            myreport.Database.Tables[0].SetDataSource(td);
            CrystalReportViewer1.ReportSource = myreport;
            Logininfo();

            //int count = Convert.ToInt32(dt.Tables[0].Rows.Count);
            myConnection.Close();
        }

}