LilyRock
asked on
crystal report converted from 1.0 to 4.0 .NET not working
I have inherited a website designed in .NET framework 1.0. I have to convert to new 4.0 NET framework. Everything else works except the crystal report page.
Here is the code for the page:
public distance_grp oRpt = null;
public wcn_distance_grp wcn_oRpt = null;
private void Page_Load(object sender, System.EventArgs e)
{
//
// Verify access to page
//
PageAccessManager.VerifyAc cessOrRedi rectToLogi n(this.Pag e);
string sMemberName = this.Session["PageAccessMa nager.Memb erName"].T oString();
string sPagename = this.Page.Request.Path;
PageAccessManager.LogMembe rActivity( sMemberNam e,sPagenam e,"READ",n ull,null,n ull,null);
//
// Set up SQL parameters
//
string stringZipCode = Request.QueryString["ZipCo de"];
string stringRadius = Request.QueryString["Radiu s"];
string stringSpecialtyCode = Request.QueryString["Speci alty"];
string stringSpecialtyId = Request.QueryString["Speci altyId"];
string stringClassId = Request.QueryString["Class Id"];
string stringClass = Request.QueryString["Class "];
//
// Set up the titles in the report
//
string stringTitle1 = stringClass;
string stringTitle2 = "Within " + stringRadius + " mile(s) of " + stringZipCode;
//determine where it came from
string stringFrom = "";
if ( Request.QueryString["fr"] != null)
stringFrom = Request.QueryString["fr"];
// create the report instance
if (stringFrom =="")
oRpt = new distance_grp();
else
wcn_oRpt = new wcn_distance_grp();
// fill dataset
string stringConnectionString = Administrator.ConnectionSt ring;
SqlConnection connectionInformedCare = new SqlConnection(stringConnec tionString );
SqlDataAdapter adapterPM = new SqlDataAdapter(); //stringSQLSelect, connectionInformedCare);
SqlCommand oCmd = new SqlCommand("procedureProvi dersByDist anceGet", connectionInformedCare);
oCmd.CommandType = System.Data.CommandType.St oredProced ure;
oCmd.Parameters.Add("@ZipC ode", stringZipCode);
oCmd.Parameters.Add("@Spec CodeId",st ringSpecia ltyId);
oCmd.Parameters.Add("@Clas sCodeId",s tringClass Id);
oCmd.Parameters.Add("@Radi us", stringRadius);
oCmd.Parameters.Add("@Memb erName",th is.Session ["PageAcce ssManager. MemberName "].ToStrin g());
connectionInformedCare.Ope n();
adapterPM.SelectCommand=oC md;
DataSet dataSet = new DataSet();
adapterPM.Fill (dataSet, "procedureProvidersByDista nceGet");
connectionInformedCare.Clo se();
connectionInformedCare.Dis pose();
try
{
// set report data source
if (stringFrom != "")
wcn_oRpt.SetDataSource(dat aSet);
else
oRpt.SetDataSource(dataSet .Tables[0] );
}
catch (Exception excp)
{
string msg = excp.Message;
Response.Write(msg);
}
// Set export params
CrystalDecisions.Shared.Ex portOption s exp = new CrystalDecisions.Shared.Ex portOption s();
exp.ExportFormatType = CrystalDecisions.Shared.Ex portFormat Type.Porta bleDocForm at;
exp.FormatOptions = new CrystalDecisions.Shared.Pd fRtfWordFo rmatOption s();
CrystalDecisions.Shared.Ex portReques tContext req = new CrystalDecisions.Shared.Ex portReques tContext() ;
req.ExportInfo = exp;
CrystalDecisions.Shared.Pa rameterVal ues crParameterValues;
ParameterFieldDefinitions crParameterFieldDefinition s;
ParameterFieldDefinition crParameterFieldDefinition ;
// get field defs collection
if (stringFrom == "")
crParameterFieldDefinition s = oRpt.DataDefinition.Parame terFields;
else
crParameterFieldDefinition s = wcn_oRpt.DataDefinition.Pa rameterFie lds;
// Get fields def
crParameterFieldDefinition s.MoveNext ();
crParameterFieldDefinition = (ParameterFieldDefinition) crParamete rFieldDefi nitions.Cu rrent;
// get values collection
crParameterValues = crParameterFieldDefinition .CurrentVa lues;
-------------------------- ---------- ---------- ----------
THE ERROR SHOWS UP ON THIS LINE OF CODE
crParameterFieldDefinition = (ParameterFieldDefinition) crParamete rFieldDefi nitions.Cu rrent;
"value does not fall within the expected range "
I'm not sure what's going on here. Please help!
Here is the code for the page:
public distance_grp oRpt = null;
public wcn_distance_grp wcn_oRpt = null;
private void Page_Load(object sender, System.EventArgs e)
{
//
// Verify access to page
//
PageAccessManager.VerifyAc
string sMemberName = this.Session["PageAccessMa
string sPagename = this.Page.Request.Path;
PageAccessManager.LogMembe
//
// Set up SQL parameters
//
string stringZipCode = Request.QueryString["ZipCo
string stringRadius = Request.QueryString["Radiu
string stringSpecialtyCode = Request.QueryString["Speci
string stringSpecialtyId = Request.QueryString["Speci
string stringClassId = Request.QueryString["Class
string stringClass = Request.QueryString["Class
//
// Set up the titles in the report
//
string stringTitle1 = stringClass;
string stringTitle2 = "Within " + stringRadius + " mile(s) of " + stringZipCode;
//determine where it came from
string stringFrom = "";
if ( Request.QueryString["fr"] != null)
stringFrom = Request.QueryString["fr"];
// create the report instance
if (stringFrom =="")
oRpt = new distance_grp();
else
wcn_oRpt = new wcn_distance_grp();
// fill dataset
string stringConnectionString = Administrator.ConnectionSt
SqlConnection connectionInformedCare = new SqlConnection(stringConnec
SqlDataAdapter adapterPM = new SqlDataAdapter(); //stringSQLSelect, connectionInformedCare);
SqlCommand oCmd = new SqlCommand("procedureProvi
oCmd.CommandType = System.Data.CommandType.St
oCmd.Parameters.Add("@ZipC
oCmd.Parameters.Add("@Spec
oCmd.Parameters.Add("@Clas
oCmd.Parameters.Add("@Radi
oCmd.Parameters.Add("@Memb
connectionInformedCare.Ope
adapterPM.SelectCommand=oC
DataSet dataSet = new DataSet();
adapterPM.Fill (dataSet, "procedureProvidersByDista
connectionInformedCare.Clo
connectionInformedCare.Dis
try
{
// set report data source
if (stringFrom != "")
wcn_oRpt.SetDataSource(dat
else
oRpt.SetDataSource(dataSet
}
catch (Exception excp)
{
string msg = excp.Message;
Response.Write(msg);
}
// Set export params
CrystalDecisions.Shared.Ex
exp.ExportFormatType = CrystalDecisions.Shared.Ex
exp.FormatOptions = new CrystalDecisions.Shared.Pd
CrystalDecisions.Shared.Ex
req.ExportInfo = exp;
CrystalDecisions.Shared.Pa
ParameterFieldDefinitions crParameterFieldDefinition
ParameterFieldDefinition crParameterFieldDefinition
// get field defs collection
if (stringFrom == "")
crParameterFieldDefinition
else
crParameterFieldDefinition
// Get fields def
crParameterFieldDefinition
crParameterFieldDefinition
// get values collection
crParameterValues = crParameterFieldDefinition
--------------------------
THE ERROR SHOWS UP ON THIS LINE OF CODE
crParameterFieldDefinition
"value does not fall within the expected range "
I'm not sure what's going on here. Please help!
ASKER
It's now version 13, runtime version 2.0
I'd got this version from SAP website yesterday.
It was built in .NET 1.0 in the back old day.
Thanks
I'd got this version from SAP website yesterday.
It was built in .NET 1.0 in the back old day.
Thanks
So long s you use VS2010 you should be ok.
Version 13 also known as CR4VS2010, is specifically for use with VS2010.
mlmcc
Version 13 also known as CR4VS2010, is specifically for use with VS2010.
mlmcc
ASKER
Yes. Indeed. I've got that version and using VS2010.
Do you see anything would give that kind of error? I have searched the nets and not found any answer.
Do you see anything would give that kind of error? I have searched the nets and not found any answer.
I hav enever seen that error. I don't know what it means.
mlmcc
mlmcc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Vasto,
Your codes seem to work! Thanks for you help.
Your codes seem to work! Thanks for you help.
You are welcome :)
You may have to upgrade.
mlmcc