Problem while calling a .Net component

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hello,

Technology used: BTS2006 R2 and C#

I am having some problem when trying to get some values from database using
a .Net component from my orchestration.
I declared my classes as [Serializable] like
[Serializable]
public class Partner
{
}

Within this class I have called a method of another class as

.........
dtABBPartnerInfo=oDBAccess.RunSPReturnDataTable("[EDIRouting].[dbo].[SP_GetABBPartnerInformation]", parms);
oDBAccess.CloseConnection();
if (dtABBPartnerInfo!=null)
{
if (dtABBPartnerInfo.Rows.Count > 0)
{
// Here I am not able to set the return values since
dtABBPartnerInfo.Rows.Count=0
}
}
.........

The other class have the following method

public DataTable RunSPReturnDataTable(string sSPName, SqlParameter[] cmdParms)
{
DataTable dt = new DataTable();

try
{
OpenConnection();
SqlCommand cmd = new SqlCommand();
SqlDataAdapter sqlDA = new SqlDataAdapter();

cmd.Connection = sqlCon;
cmd.CommandText = sSPName;
cmd.CommandType = CommandType.StoredProcedure;
if (cmdParms != null)
{
foreach (SqlParameter parm in cmdParms)
{
LogInfo(parm.ParameterName + ":" +
parm.Value.ToString());
cmd.Parameters.Add(parm);
}
}
//if (TransactionType != TransType.NoneTransactional)
// cmd.Transaction = Transaction;
DataSet ds = new DataSet();
sqlDA.SelectCommand = cmd;
sqlDA.Fill(ds);
LogInfo("ABB.DXS.US.INSIGHT.Helper >>DBAccess >>
RunSPReturnDataTable():: ds.Tables[0].Rows.Count.ToString():" +
ds.Tables[0].TableName+","+ds.Tables.Count.ToString()+","
+ds.Tables[0].Rows.Count.ToString());
dt = ds.Tables[0];
cmd.Dispose();
CloseConnection();
}
catch (Exception ex)
{
LogError("ABB.DXS.US.Utilities.SQLDatabaseTier >>DBAccess >>
RunSPReturnDataSet():: Error Description:" + ex.Message + "," +
ex.StackTrace);
dt= null;
}
return dt;
}

I am logging values using LogInfo method into EventLog and it is not showing
rowcount as 0.

My Store Procedure:
=============
CREATE PROCEDURE [dbo].[SP_GetABBPartnerInformation]
@CovastRecipientID varchar(50),
@CovastSenderID varchar(50),
@TransactionType varchar(25),
@TransactionVersion varchar(25)
AS
BEGIN
SELECT ABBRecipientID, ABBSenderID
FROM [EDIRouting].[dbo].[TBL_RoutingInfo]
WHERE (CovastRecipientID = @CovastRecipientID) AND (CovastSenderID =
@CovastSenderID) AND (TransactionType = @TransactionType) AND
(TransactionVersion = @TransactionVersion)
END

~~~~~~~~~~~~~~~~

I tried with the same classes from a windows application. I was able to find
the record. I wonder what might be the issue.

Please let me know if anybody have any idea.

Thanks and Regards
Sourav.


.



Relevant Pages

  • RE: Problem while calling a .Net component
    ... public DataTable RunSPReturnDataTable(string sSPName, SqlParametercmdParms) ... SqlCommand cmd = new SqlCommand; ... foreach (SqlParameter parm in cmdParms) ...
    (microsoft.public.biztalk.general)
  • Re: Problem while calling a .Net component
    ... public DataTable RunSPReturnDataTable(string sSPName, SqlParametercmdParms) ... SqlCommand cmd = new SqlCommand; ... foreach (SqlParameter parm in cmdParms) ... My Store Procedure: ...
    (microsoft.public.biztalk.general)