Problem while calling a .Net component
- From: Sourav Dutta Gupta <SouravDuttaGupta@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 16 Jul 2007 23:46:00 -0700
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.
.
- Follow-Ups:
- Re: Problem while calling a .Net component
- From: Stefan
- RE: Problem while calling a .Net component
- From: Saravana Kumar [MVP]
- Re: Problem while calling a .Net component
- Prev by Date: Re: msmq adapter working slow
- Next by Date: Re: Tracking Messages not in HAT
- Previous by thread: Re: msmq adapter working slow
- Next by thread: RE: Problem while calling a .Net component
- Index(es):
Relevant Pages
|