Click here to Skip to main content
15,893,790 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

Below are my methods.
C#
public static bool SaveXmlInfo(Sales1 sales1)
{
   int recordsAffected = 0;

    string orderXml = string.Empty;

    StringWriter output = new StringWriter();

    //Seriealize class object into XML type.

    XmlSerializer xs = new XmlSerializer(salesPurchase.GetType());

    xs.Serialize(output, salesPurchase);

    orderXml = Convert.ToString(output);

    //Converting string type XML data into XML format.          

    XElement planPropertyElement = XElement.Parse(orderXml);

//HERE I WANT TO MODIFY INNER XML WHICH IS AVAILABLE IN planPropertyElement VARIABLE ELEMENT //NAME,ITS ATTRIBUTE NAME,DELETE ATTRIBUTE AND SO ON….HOW I MODIFY THIS XML PART……………..

   using (SqlConnection conn = new SqlConnection(ConnectionString1))

    {

        conn.Open();

        SqlParameter[] parms = new SqlParameter[2];

        parms[0] = new SqlParameter("@RCustId", sales1.RCustId);

        parms[1] = new SqlParameter("@SesId", sales1.SesId);

        parms[2] = new SqlParameter

        {
            ParameterName = "@CenXml",

            SqlDbType = SqlDbType.Xml,

            Value = new SqlXml(planPropertyElement.CreateReader())

        };

recordsAffected = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "usp_PurchXml", parms);

        salesPurchase = null;

    }

    return recordsAffected > 0 ? true : false;

}
Posted
v3
Comments
[no name] 3-Apr-13 8:19am    
Do not ask your question as embedded comments. It is very hard to find what it is that you are asking. And screaming does not help either.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900