1
Answer

Update Xml Record In Database Asp Net Mvc

Photo of Nabil Nawaz

Nabil Nawaz

7y
207
1
Hello guys !
i've a scenario in asp net mvc with entity framework where when user enter a record i save it in one field in XML form after converting whole object into XML.
 
now i'm not able to update it. like when user updates the record i want previous XML to be there and new updated XML come into that column following the previous XML in that column
 
like
 
this is when user submits a new record the XML is saved like this

<?xml version="1.0" encoding="utf-16"?>
<UserRightsXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 
<Id_Num>0</Id_Num>
<RecordId>45</RecordId>
<User_Reg_02_Id_Num>17</User_Reg_02_Id_Num>
<Cr_Id>30</Cr_Id>
<Cr_Date>2017-07-23T16:32:23.0543196+05:00</Cr_Date>
<Cr_Log>messi@icon.com / MESSI / MESSI-PC / 192.168.1.4 / C4544458517B</Cr_Log>
<Up_Id xsi:nil="true" />
<Up_Date xsi:nil="true" />
 
</UserRightsXml>
 
now when user updates this record i want data to be saved like this

<?xml version="1.0" encoding="utf-16"?>
<UserRightsXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 
<Id_Num>0</Id_Num>
<RecordId>45</RecordId>
<User_Reg_02_Id_Num>17</User_Reg_02_Id_Num>
<Cr_Id>30</Cr_Id>
<Cr_Date>2017-07-23T16:32:23.0543196+05:00</Cr_Date>
<Cr_Log>messi@icon.com / MESSI / MESSI-PC / 192.168.1.4 / C4544458517B</Cr_Log>
<Up_Id xsi:nil="true" />
<Up_Date xsi:nil="true" />
 
<Id_Num>0</Id_Num>
<RecordId>45</RecordId>
<User_Reg_02_Id_Num>18</User_Reg_02_Id_Num>
<Cr_Id>30</Cr_Id>
<Cr_Date>2017-07-23T16:32:23.0543196+05:00</Cr_Date>
<Cr_Log>nabil@icon.com / MESSI / MESSI-PC / 192.168.1.4 / C4544458517B</Cr_Log>
<Up_Id xsi:nil="true" />
<Up_Date xsi:nil="true" />
 
</UserRightsXml>
 
and so on whenever record gets updated

Answers (1)

0
Photo of Vulpes
NA 98.3k 1.5m 13y
None of those functions are anything to do with ASP.NET as such though they can be called from it (using the Platform Invoke mechanism in the case of the first two).

Briefly:

* LoadLibrary is an unmanaged function which loads a dll into a process's address space.

* CoCreateInstance is an unmanaged funmction which creates a COM object using its Class Id (CLSID).

* CreateObject is a VB library function which creates a COM object using its Program Id (ProgID).

* Assembly.Load is a .NET method which loads an assembly at runtime.