Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to deploy crystal reports 2008 on shared server. Before publishing on the remote server i published it on the localhost while connecting it to remote sql server 2008 database. The report is shown perfactly but when i publish it on shared server it prompt me for login credentials. My hosting provider is znetliveand it support crystal report. In my popup database field is empty and locked use name field show the correct user name and password field is empty.


public void LoadReport(string reportName, NameValueCollection plist)
{
ReportDocument rd = new ReportDocument();
DataSet ds = new DataSet();
ds = dataReport(plist);
string path = Server.MapPath("~/") + reportName + ".rpt";
rd.Load(path);
rd.SetDataSource(ds);
IMConnectionInfo info = new IMConnectionInfo(conn_string);
Tables tables = rd.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table mytable in tables)
{
TableLogOnInfo myLoginfo = new TableLogOnInfo();
myLoginfo.ConnectionInfo.ServerName = info.ServerName;
myLoginfo.ConnectionInfo.IntegratedSecurity = info.IntegratedSecurity;
myLoginfo.ConnectionInfo.DatabaseName = info.DatabaseName;
if (!info.IntegratedSecurity)
{
myLoginfo.ConnectionInfo.UserID = info.UserName;
myLoginfo.ConnectionInfo.Password = info.Password;
}
mytable.ApplyLogOnInfo(myLoginfo);
}

if (plist != null)
{
foreach (string p in plist.Keys)
{
rd.SetParameterValue(p, plist.Get(p));
}
}
CrystalReportViewer1.Visible = true;
CrystalReportViewer1.ReportSource = rd;
CrystalReportViewer1.DataBind();


}

public DataSet dataReport(NameValueCollection plist)
{
DataSet ds = new DataSet();
SqlConnection conn = new SqlConnection(conn_string);
SqlCommand comm = new SqlCommand();

if (plist != null)
{
foreach (string p in plist.Keys)
{
comm.Parameters.AddWithValue(p, plist.Get(p));
}
}
comm.CommandText = "select_techr";
comm.CommandType = CommandType.StoredProcedure;
comm.Connection = conn;
SqlDataAdapter da = new SqlDataAdapter(comm);
da.Fill(ds, "select_techr");
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
return ds;
}
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