Re: Problem while calling a .Net component



On 17 juil, 08:46, Sourav Dutta Gupta
<SouravDuttaGu...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
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.

Could you use the SQL profiler and see what are the parameters that
the stored procedure receives? I think it's the best and quickest way
to find out what's wrong...

Regards,
Stefan
http://www.itsconsulting.fr

.



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)
  • 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)