tags:

views:

82

answers:

0

Hi guys..

I have a problem with my code. I used ASP.NET with Visual Studio 2010.

When i retrieve a data from database to a datatable in a webservice, some column give me a empty string data. This caused some problem with the XML retrieved and displayed. I try to put a Replace ("","") to replace \0\0\0. THis one can solve the problem. But now the problem is, the orginal data still shown in the XML. The original data is the one with \0\0.Before replace, the XML field is <VNDPNO></VNDPNO> and after replace become <VNDPNO />.

My question is, how to hide the original data. I dont want the original data when i call it It keep showing in the web browser in <diffgr:before>.

My source code is :

public DataTable GetItmSupDtls(string companycode, string itemCode, 
                               string itemMajor, string itemMinor)
{
    DataTable dsItmSupDtls;
    //DataSet dsItmSupDtls = new DataSet();
    IDBManager dbManager = new DBManager(DataProvider.SqlServer);
    dbManager.ConnectionString = _connString;
    try
    {
        dbManager.Open();
        dbManager.CreateParameters(4);
        dbManager.AddParameters(0, "@COYCDE", (object)companycode);
        dbManager.AddParameters(1, "@ITMCDE", (object)itemCode);
        dbManager.AddParameters(2, "@ITMMAJ", (object)itemMajor);
        dbManager.AddParameters(3, "@ITMMIN", (object)itemMinor);
        dsItmSupDtls = dbManager.ExecuteDataSet(
            CommandType.StoredProcedure, 
            Utilities.DatabaseName("DBPurchase") + ".dbo.ITMSUPINFO_STKBALENQUIRY"
        ).Tables[0];
    }

    catch (Exception ex)
    {
        throw ex;
    }

    finally
    {
        dbManager.Dispose();
    }

    DataTable result = dsItmSupDtls.Clone();

    foreach (DataRow dtRow in dsItmSupDtls.Rows)
    {
        dtRow["VNDPNO"] = 
            dtRow["VNDPNO"].ToString().Replace("\0", ""); //"A"; //
        result.ImportRow(dtRow);
    }
    return result;
}

Kindly give me some comment and suggestion.

Many thanks..