GoldenJag
asked on
SQL Connection using CommandType.StoredProcedure and SQLDataAdapter
I am new to .NET so any advice is welcomed. Can someone tell me what i am doing wrong in this segment of code.
I am trying to run a Crystal Report and I have defined a Dataset1.xsd in my project. I am not sure if i am doing the comd.Connection correctly. but i get an error (on line "da.Fill(ds); " that says:
Can someone help me with this.
{"Load report failed." }
System.Object: {System.Exception}
_className: null
_COMPlusExceptionCode: -532459699
_exceptionMethod: <undefined value>
_exceptionMethodString: null
_helpURL: null
_HResult: -2146233088
_innerException: {"Not enough memory for operation." }
SqlConnection sqlConn = new SqlConnection(pm.connectio n);
SqlCommand comd=sqlConn.CreateCommand (); //??
comd = new SqlCommand();
comd.Connection = sqlConn;
comd.CommandType = CommandType.StoredProcedur e;
comd.CommandText = "sp_Test";
//comd.Parameters.Add("@Pr ogID",SqlD bType.VarC har,50);
sqlConn.Open();
SqlDataAdapter da = new SqlDataAdapter(comd);
//TEST
try
{
Dataset1 ds = new Dataset1();
da.Fill(ds); //ERRORS HERE
oRpt.SetDataSource(ds);
CrystalReportViewer1.Repor tSource = oRpt;
}
catch(Exception ex)
{
Response.Write(ex.Message. ToString() );
}
Thanks!
I am trying to run a Crystal Report and I have defined a Dataset1.xsd in my project. I am not sure if i am doing the comd.Connection correctly. but i get an error (on line "da.Fill(ds); " that says:
Can someone help me with this.
{"Load report failed." }
System.Object: {System.Exception}
_className: null
_COMPlusExceptionCode: -532459699
_exceptionMethod: <undefined value>
_exceptionMethodString: null
_helpURL: null
_HResult: -2146233088
_innerException: {"Not enough memory for operation." }
SqlConnection sqlConn = new SqlConnection(pm.connectio
SqlCommand comd=sqlConn.CreateCommand
comd = new SqlCommand();
comd.Connection = sqlConn;
comd.CommandType = CommandType.StoredProcedur
comd.CommandText = "sp_Test";
//comd.Parameters.Add("@Pr
sqlConn.Open();
SqlDataAdapter da = new SqlDataAdapter(comd);
//TEST
try
{
Dataset1 ds = new Dataset1();
da.Fill(ds); //ERRORS HERE
oRpt.SetDataSource(ds);
CrystalReportViewer1.Repor
}
catch(Exception ex)
{
Response.Write(ex.Message.
}
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am using MS C# Development Environment 2003 version 7.1.3088 (Visual Studio 6.0)
MS.Net Framework 1.1 version 4322 SP1, Crystal XI.
The program errors here: da.Fill(ds); //ERRORS HERE
the error also occurs when i use da.Fill(ds,"TableName");
MS.Net Framework 1.1 version 4322 SP1, Crystal XI.
The program errors here: da.Fill(ds); //ERRORS HERE
the error also occurs when i use da.Fill(ds,"TableName");
ASKER
I am sorry guys. i gave you wrong info about where program errored.
It errored at : oRpt.SetDataSource(ds); and not at the da.Fill(ds).
It errored at : oRpt.SetDataSource(ds); and not at the da.Fill(ds).
This is definitely a Crystal problem then, I think there is a business objects hotfix for it, though I haven't come across this problem myself or had the need to test the hotfix.
SqlCommand comd=sqlConn.CreateCommand
comd.CommandType = CommandType.StoredProcedur
//comd.Parameters.Add("@Pr
SqlDataAdapter da = new SqlDataAdapter(comd);