Click here to Skip to main content
15,923,051 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: About DataGrid Pin
eyeseetee3-Jun-08 1:09
eyeseetee3-Jun-08 1:09 
AnswerRe: About DataGrid Pin
Jintal Patel3-Jun-08 3:12
Jintal Patel3-Jun-08 3:12 
Questionreport Viewer Pin
eyeseetee3-Jun-08 0:43
eyeseetee3-Jun-08 0:43 
QuestionAbout DataGrid Pin
EzhilarasiMSc3-Jun-08 0:12
EzhilarasiMSc3-Jun-08 0:12 
AnswerRe: About DataGrid Pin
eyeseetee3-Jun-08 0:46
eyeseetee3-Jun-08 0:46 
Questiondynamically assigning connection string name to membership provider at Runtime Pin
neilsuresh2-Jun-08 23:58
neilsuresh2-Jun-08 23:58 
AnswerRe: dynamically assigning connection string name to membership provider at Runtime Pin
eyeseetee3-Jun-08 0:45
eyeseetee3-Jun-08 0:45 
QuestionCrystal Report in ASP.NET Pin
senthilsstil2-Jun-08 23:40
senthilsstil2-Jun-08 23:40 
Hi Friends,
I m doing crystal report in asp.net2.0 using c#,i have written the code for crystal report dynamically getting the database connection from web.config file and i have created the crystal report manually making the database connection mapping the stored procedure.I m getting the output correctly.The problem is if i need to change the database server name means i should change only in web.config file,but i have given the connection for crystal report in code behind and crystal report manually.When i change the database server name in web.config file its not getting the effect only when i connect crystal report manually its getting connected.Sorry for long comments here is the coding for database connection.Please help me to solve the solution

protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack == false)
{
string from = "";
string id = "";
string to = "";
string mode = "";
from =Request.QueryString["FromDate"];
id = Request.QueryString["id"];
to = Request.QueryString["toDate"];
mode =Request.QueryString["mode"];

ReportDocument rd = new ReportDocument();
rd.Load(Server.MapPath("TourOperator.rpt"));
rd.SetParameterValue(0, mode);
rd.SetParameterValue(1, id);
rd.SetParameterValue(2, from);
rd.SetParameterValue(3, to);
GetServerName(rd);
Session["torRep"] = rd;

foreach (CrystalDecisions.CrystalReports.Engine.ReportObject obj in rd.ReportDefinition.ReportObjects)
{
if (obj.Name == "txtfromdate")
{
((TextObject)obj).Text = from;
}
if(obj.Name=="txttodate")
{
((TextObject)obj).Text = to;
}
}

if (rd.Rows.Count > 0)
{
CrystalReportViewer1.Visible = true;
CrystalReportViewer1.ReportSource = rd;
CrystalReportViewer1.DataBind();
}
else
{
CrystalReportViewer1.Visible = false;
ltl.Text = "<b><font color='red'>No Records Found</font></b>";
}
}
else
{
CrystalReportViewer1.ReportSource = (ReportDocument)Session["torRep"];
CrystalReportViewer1.DataBind();
}
}
private void GetServerName(ReportDocument rep)
{
try
{
ConnectionInfo cinfo = new ConnectionInfo();
TableLogOnInfo tinfo = new TableLogOnInfo();
string cStr = ConfigurationManager.ConnectionStrings["sqlcon"].ConnectionString;
cinfo.ServerName = cStr.Split(';')[0].Split('=')[1];
cinfo.DatabaseName = cStr.Split(';')[3].Split('=')[1];
cinfo.UserID = cStr.Split(';')[1].Split('=')[1];
cinfo.Password = cStr.Split(';')[2].Split('=')[1];
foreach (CrystalDecisions.CrystalReports.Engine.Table objTable in rep.Database.Tables)
{
tinfo = objTable.LogOnInfo;
tinfo.ConnectionInfo = cinfo;
objTable.ApplyLogOnInfo(tinfo);
}
}
catch (Exception ex)
{
throw ex;
}
}

Thanks in Advance
QuestionHow to retrieve images from SQL SERVER 2005 on to an ASP.NET page in C# Pin
SinghSu2-Jun-08 23:07
SinghSu2-Jun-08 23:07 
AnswerRe: How to retrieve images from SQL SERVER 2005 on to an ASP.NET page in C# Pin
Christian Graus3-Jun-08 2:14
protectorChristian Graus3-Jun-08 2:14 
GeneralRe: How to retrieve images from SQL SERVER 2005 on to an ASP.NET page in C# Pin
SinghSu3-Jun-08 20:34
SinghSu3-Jun-08 20:34 
QuestionHow to Identify that Connected database is MySql, Sql Express, Sql Server 2000, etc. Pin
pandeybrijendra2-Jun-08 23:04
pandeybrijendra2-Jun-08 23:04 
QuestionMultiple Gridview mantaining LINQ relationships Pin
Ponzano Paolo2-Jun-08 21:43
Ponzano Paolo2-Jun-08 21:43 
Questionhow to associate event handler for dynamically created dropdownlist Pin
vidhyap2-Jun-08 21:35
vidhyap2-Jun-08 21:35 
AnswerRe: how to associate event handler for dynamically created dropdownlist Pin
eyeseetee2-Jun-08 21:58
eyeseetee2-Jun-08 21:58 
AnswerRe: how to associate event handler for dynamically created dropdownlist Pin
N a v a n e e t h2-Jun-08 22:15
N a v a n e e t h2-Jun-08 22:15 
GeneralRe: how to associate event handler for dynamically created dropdownlist Pin
vidhyap2-Jun-08 23:34
vidhyap2-Jun-08 23:34 
GeneralRe: how to associate event handler for dynamically created dropdownlist Pin
N a v a n e e t h3-Jun-08 0:01
N a v a n e e t h3-Jun-08 0:01 
GeneralRe: how to associate event handler for dynamically created dropdownlist Pin
vidhyap3-Jun-08 0:14
vidhyap3-Jun-08 0:14 
GeneralRe: how to associate event handler for dynamically created dropdownlist Pin
N a v a n e e t h3-Jun-08 1:02
N a v a n e e t h3-Jun-08 1:02 
GeneralRe: how to associate event handler for dynamically created dropdownlist Pin
vidhyap3-Jun-08 18:18
vidhyap3-Jun-08 18:18 
GeneralRe: how to associate event handler for dynamically created dropdownlist Pin
N a v a n e e t h4-Jun-08 3:48
N a v a n e e t h4-Jun-08 3:48 
AnswerRe: how to associate event handler for dynamically created dropdownlist Pin
Baran M3-Jun-08 3:24
Baran M3-Jun-08 3:24 
GeneralRe: how to associate event handler for dynamically created dropdownlist Pin
vidhyap3-Jun-08 17:03
vidhyap3-Jun-08 17:03 
Questionajaxtoolkit problem Pin
Miss Maheshwari2-Jun-08 21:23
Miss Maheshwari2-Jun-08 21:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.