473,738 Members | 3,636 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot close connection of crystal report

In my ASP.NET page, I have 2 checkboxes for users to choose which
crystal report they want to display. These two reports use different
tables. If report1 has been choosen and displayed in the crystal
report, then I cannot check another checkbox to display report2
afterwards. If I close the website and open again, I can choose report2
and display as crystal report correct, but now I cannot check the
checkbox1 to display report 1 afterwards.
This is the error message:

Error in File
C:\DOCUME~1\CHR ISHO\ASPNET\LOC ALS~1\Temp\temp _c58d8a47-521f-4540-bf93-d4f493584892.rp t:
Error in formula <Record_Selecti on>. '{INUTMTI_TERM. part_user} =
{?in_user} and ' This field name is not known.
The table INUTMTI_TERM is the table used by report 1, not by report 2,
but it's trying to access this table when I choose to display report2.
Although I try to close the report in the Page_Unload() method, somehow
the crystal report connection would not close and cause this problem.
I'm attaching my code here (some code deleted to improve readability).
Please give me some hint on how to solve this problem.

Thanks,
Christine
namespace inventory
{

public class userreqterm : System.Web.UI.P age
{
protected CrystalDecision s.Web.CrystalRe portViewer
CrystalReportVi ewer1;
userreqtermCR crReportDocumen t;
userreqtermWCR crReportDocumen t2;
TableLogOnInfo crTableLogOnInf o = new TableLogOnInfo( );
ConnectionInfo crConnectionInf o = new ConnectionInfo( );
TableLogOnInfo crTableLogOnInf o2 = new TableLogOnInfo( );
CrystalDecision s.CrystalReport s.Engine.Databa se crDatabase;
CrystalDecision s.CrystalReport s.Engine.Databa se crDatabase2;
CrystalDecision s.CrystalReport s.Engine.Tables crTables2;
private void Page_Load(objec t sender, System.EventArg s e)
{
crReportDocumen t = new userreqtermCR() ;
crReportDocumen t2 = new userreqtermWCR( );
crConnectionInf o.ServerName = "x.x.x.x";
crConnectionInf o.DatabaseName = "xxxx";
crConnectionInf o.UserID = "xxxx";
crConnectionInf o.Password = "xxxx";
crDatabase = crReportDocumen t.Database;
crTables = crDatabase.Tabl es;
crDatabase2 = crReportDocumen t2.Database;
crTables2 = crDatabase2.Tab les;

foreach(Crystal Decisions.Cryst alReports.Engin e.Table crTable in
crTables)
{
crTableLogOnInf o = crTable.LogOnIn fo;
crTableLogOnInf o.ConnectionInf o = crConnectionInf o;
crTable.ApplyLo gOnInfo(crTable LogOnInfo);
}

foreach(Crystal Decisions.Cryst alReports.Engin e.Table crTable2 in
crTables2)
{
crTableLogOnInf o2 = crTable2.LogOnI nfo;
crTableLogOnInf o2.ConnectionIn fo = crConnectionInf o;
crTable2.ApplyL ogOnInfo(crTabl eLogOnInfo2);
}
}

private void Page_Unload(obj ect sender, System.EventArg s e)
{
crReportDocumen t.Close();
crReportDocumen t.Dispose();
crReportDocumen t2.Close();
crReportDocumen t2.Dispose();
crReportDocumen t = null;
crReportDocumen t2 = null;
crTableLogOnInf o = null;
crTableLogOnInf o2 = null;
crConnectionInf o=null;
crDatabase =null;
crTables = null;
crDatabase2 = null;
crTables2 = null;
CrystalReportVi ewer1.Dispose() ;
CrystalReportVi ewer1 = null;
}
private void run_Click(objec t sender, System.EventArg s e)
{
SqlCommand command = new SqlCommand("inu tmti_upd_chrg", connection);
command.Connect ion=connection;
command.Command Type=CommandTyp e.StoredProcedu re;
command.Command Text = "inutmti_upd_ch rg";
command.Paramet ers.Add(new
SqlParameter("@ in_user",SqlDbT ype.VarChar, 5));
command.Paramet ers["@in_user"].Value=departme nt.SelectedValu e.ToString();
command.Paramet ers.Add(new
SqlParameter("@ in_yyyymmdd",Sq lDbType.DateTim e, 8));
command.Paramet ers["@in_yyyymm dd"].Value=termendd ate.Text.ToStri ng();
connection.Open ();
command.Execute NonQuery();
connection.Clos e();

ParameterFields paramFields = new ParameterFields ();
ParameterField user = new ParameterField( );
ParameterField dept = new ParameterField( );
ParameterField yyyymmdd = new ParameterField( );
ParameterDiscre teValue dcuser = new ParameterDiscre teValue();
ParameterDiscre teValue dcdept = new ParameterDiscre teValue();
ParameterDiscre teValue dcyyyymmdd = new ParameterDiscre teValue();

dept.ParameterF ieldName = "in_dept";
dcdept.Value = department.Sele ctedItem.Text.T oString();
dept.CurrentVal ues.Add(dcdept) ;

user.ParameterF ieldName = "in_user";
dcuser.Value = department.Sele ctedValue.ToStr ing();
user.CurrentVal ues.Add(dcuser) ;

yyyymmdd.Parame terFieldName = "in_yyyymmd d";
dcyyyymmdd.Valu e = termenddate.Tex t.ToString();
yyyymmdd.Curren tValues.Add(dcy yyymmdd);

paramFields.Add (user);
paramFields.Add (dept);
paramFields.Add (yyyymmdd);

if(option.Selec tedValue.ToStri ng()=="L")
{
CrystalReportVi ewer1.ReportSou rce = crReportDocumen t;
CrystalReportVi ewer1.Parameter FieldInfo = paramFields;
CrystalReportVi ewer1.Visible=t rue;
CrystalReportVi ewer1.DataBind( );

}
else if(option.Selec tedValue.ToStri ng()=="W")
{
CrystalReportVi ewer1.ReportSou rce = crReportDocumen t2;
CrystalReportVi ewer1.Parameter FieldInfo = paramFields;
CrystalReportVi ewer1.Visible=t rue;
CrystalReportVi ewer1.DataBind( );

}

crTableLogOnInf o = null;
crTableLogOnInf o2 = null;
crConnectionInf o=null;
crDatabase =null;
crTables = null;
crDatabase2 = null;
crTables2 = null;
}
}
}

Jan 13 '06 #1
0 3906

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1940
by: Meral Agceli via .NET 247 | last post by:
A crystal report is developed using Crystal 8.5 and a trustedconnection to a SQL Server database. I'm trying to display thisreport in Crystal Report Viewer using VB.NET. When theapplication is run, I get the Login prompt every time. I want tostop this from happening by setting this within the code. I canget it to work when the report is developed with a secureconnection (username/password). I can also get it to work whenthe report is developed...
0
1739
by: Atif | last post by:
Hi All My problem is not related with this group BUT i have got a clue from here that's why i am posting this question over here. I am using Crystal Reports 9 with MySQL and SQL Server. Situation: User can select anyone of these databases and the Report should work fine I am using following connection strings to connect with databases
2
1930
by: news.microsoft.com | last post by:
Hi, (Vb.net 2003 and Crystal report.net) If my application already has a connection, how can I use it in the crystal report. I have designed some reports using the designer with vs.net03, but I do not want to embedded into the report the user id/pwd I had to use when I created the reports, as the Uid/pwd will change per users. What I want to be able to
7
2206
by: Bernie Yaeger | last post by:
I can't believe that there aren't lots of developers who: 1. create a crystal report that connects to sql server 2. calls the report using the crystalreportviewer control to view it and then, if appropriate, print it 3. tries to deploy that report to the client's database, but now it calls for a different database name Yet I can't get an answer to the question: I have developed numerous reports in an app (Windows Database App) that...
7
11249
by: Henry | last post by:
I am writing a Windows forms VB.Net/MS SQL application via VS 2003 that utilizes Crystal Reports. I want to be able to dynamically set the report data source at run time. I'm trying to change the the reports "integrated security" from TRUE to FALSE via the "Set Location" dialog in the report designer with no success. It is not intuitive (at least not to me.) I get the following error:
1
1986
by: abc | last post by:
Our web project is used VS2003 and Crystal Reports for Visual Studio.NET. There have reports that directly call to sql server's stored procedure. I also call SetDatabaseLogon method to change user id and password. But I found the crystal reports use ASPNET account to logon SQL Server, not my expected user id. Our SQL Server is MSDE and run on mixed authenitcation mode.
2
5271
by: Syrenic | last post by:
Hi Everyone, I recently developed an application using VB6 calling Crystal Report bundled with VB.NET. Problem lies here, whenever i make a call for a report view from MS Access in VB.NET. They will retrieve the data from MS Access and display it in the report viewer. But once i closes the viewer, the ldb file remains there and i can't do any other actions related to MS Access. How can I force remove ldb file in VB .NET? Or is there...
1
2474
Shashi Sadasivan
by: Shashi Sadasivan | last post by:
Hi, I have bumped into this issue where my application (which consistently reads the database) has to also create a crsytal report when requested. The crystal repost uses the same connection string as the application (i parsed the connection string and set the ConnectionInfo) However, the crystal report fails to logon and gives an exception : Logon failed. Error in File Quote {E2D18712-BD5A-4EE7-867E-79F137EB549D}.rpt: Unable to connect:...
0
2339
by: Mark Gold | last post by:
Hi! We have a VB application using Crystal Reports 6 that has worked successfully on hundreds of systems for over 10 years. Now, on one network, the application and access database does not close. It seems to hang on the command. When we open the application an peruse the screens without opening up a report (using crystal reports), the application and access db closes fine. But as soon as we run a report and then close the report and...
0
8788
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9476
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9335
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8210
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.