Hi all,
When i transfer my c#.net project to other computer,the report part of my project that worked correctly in my computer,did not work and give me this error :
"absolute path information is required"
what is my problem? i use access database for my reports
I try to create a blank report with no database,but i get this error again.
thanks for your help.Would you please send your code for loading, showing report.
I want to know, if you used untypedreport or typedReport,
WebApplication or windows application.|||public class ReportForm : System.Windows.Forms.Form
{
Thread waitThread;
ProgressBarForm pb;
private CrystalDecisions.Windows.Forms.CrystalReportViewer reportViewer;
private Reports.PulseReport pulseRpt = new Swiching.Reports.PulseReport();
private Reports.AllPulseReport allpulseRpt = new Swiching.Reports.AllPulseReport();
...
...
...
public ReportForm(string type)
{
InitializeComponent();
this.reportViewer.ReportSource = this.pulseRpt;
}
public ReportForm(string type,FileConnect.customer[] p,string bdLabel)
{
InitializeComponent();
waitThread = new Thread(new ThreadStart(wait));
waitThread.Start();
int temp;
TextObject beginRp = (TextObject)this.allpulseRpt.Section1.ReportObjects["beginRp"];
beginRp.Text = bdLabel;
OleDbConnection conn = new OleDbConnection();
conn.ConnectionString =@."......Data Source=""Swiching.mdb""......";
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = conn;
conn.Open();
string ffirst = Config.GetNum("FirstNum");
string fcap = Config.GetNum("CapNum");
for(int counter = 0;counter < int.Parse(fcap);counter++)
{
temp = int.Parse(ffirst)+counter;
cmd.CommandText = @."insert into pulse values("+temp.ToString()+","+p[counter].city.ToString()+","+p[counter].intercity.ToString(+","+p [counter].national.ToString()+")";
cmd.ExecuteNonQuery();
}
conn.Close();
this.reportViewer.ReportSource = this.allpulseRpt;
}
private void wait()
{
pb = new ProgressBarForm();
pb.ShowDialog();
}
private void ReportForm_Load(object sender, System.EventArgs e)
{
pb.Close();
}
}
When i transfer my project to other computers and call ReportForm with each of above constructors i get "absolute path infomation is required" error.|||Hi.
Where do you load report? Is it typedReport?
I read your code. But I didn't understand where you set datasource of report. It seems you connect to database directlly.
I am sorry. I don't know reason. But you can examin
Initialize reportClass PulseReport in constructor, no difinition.
Try showing report without any datbase fields.
Trace code to find exact line of error
load report by using path, not instance of typedreportdocument.|||Try hardcoding the path into your connection string
Data Source=""Swiching.mdb""......";
should be
Data Source=""D:/anywhere/data/Swiching.mdb""......";|||Hi all and thanks for your reply
I add following code after InitializeComponent() :
crConnectionInfo.ServerName = Application.StartupPath + @."\swiching.mdb";
crDatabase = allpulseRpt.Database;
crTables = crDatabase.Tables;
for (int i = 0; i < crTables.Count; i++)
{
crTable = crTables [i];
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
rTable.ApplyLogOnInfo(crTableLogOnInfo);
}
Then I try to install my program on 6 computers and i found that only two computers have this problem and my report run correctly on other computers !!!
All computers have Windows XP SP2.
Dear zdehkordi ,i load report by following code in other form :
if(type == 1)
{
ReportForm rf = new ReportForm("AllPulse",p,bdLabel,edLabel);
rf.Show();
}|||Sounds like the directory structure is different on those two computers.
How does it differ from the others?
Are all the components in the right place?
Is Application.StartPath declared and valid?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment